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.
This commit is contained in:
Phil Runninger (mac) 2018-09-09 21:29:20 -04:00
parent 7d9a3f0e8b
commit f78cf63627

View File

@ -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: