Merge pull request #871 from scrooloose/trap_bad_bookmark_path

Make sure the path to the bookmarks file exists before writing it.
This commit is contained in:
Phil Runninger 2018-09-10 17:34:06 -04:00 committed by GitHub
commit b3804dcd71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -343,7 +343,12 @@ function! s:Bookmark.Write()
for j in s:Bookmark.InvalidBookmarks()
call add(bookmarkStrings, j)
endfor
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: