nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit f78cf63627dbed66f01c4eaba37c2e5e86315d41
parent 7d9a3f0e8b1546c81e9a3591c416313f0dffd936
Author: Phil Runninger (mac) <prunninger@vhtcx.com>
Date:   Sun,  9 Sep 2018 21:29:20 -0400

Instead of creating the bookmark file path, show error message.

This change puts the burden on the user to make sure
g:NERDTreeBookmarksFile is correctly set and the path it contains is
present and has the proper permissions. If this is not the case, an
error message is displayed. This is a better solution than to blindly
create the path, when it may actually be impossible to do so.

Diffstat:
Mlib/nerdtree/bookmark.vim | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/lib/nerdtree/bookmark.vim b/lib/nerdtree/bookmark.vim
@@ -344,12 +344,11 @@ function! s:Bookmark.Write()
         call add(bookmarkStrings, j)
     endfor
 
-    let path = fnamemodify(g:NERDTreeBookmarksFile, ':h')
-    if !isdirectory(path)
-        call mkdir(path, 'p')
-    endif
-
-    call writefile(bookmarkStrings, g:NERDTreeBookmarksFile)
+    try
+        call writefile(bookmarkStrings, g:NERDTreeBookmarksFile)
+    catch
+        call nerdtree#echoError("Failed to write bookmarks file. Make sure g:NERDTreeBookmarksFile points to a valid location.")
+    endtry
 endfunction
 
 " vim: set sw=4 sts=4 et fdm=marker: