Skip to content

Commit

Permalink
Merge pull request #871 from scrooloose/trap_bad_bookmark_path
Browse files Browse the repository at this point in the history
Make sure the path to the bookmarks file exists before writing it.
  • Loading branch information
PhilRunninger authored Sep 10, 2018
2 parents 15d06b6 + f78cf63 commit b3804dc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/nerdtree/bookmark.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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:

0 comments on commit b3804dc

Please sign in to comment.