mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 03:43:50 -05:00
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:
@@ -344,12 +344,11 @@ function! s:Bookmark.Write()
|
|||||||
call add(bookmarkStrings, j)
|
call add(bookmarkStrings, j)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
let path = fnamemodify(g:NERDTreeBookmarksFile, ':h')
|
try
|
||||||
if !isdirectory(path)
|
|
||||||
call mkdir(path, 'p')
|
|
||||||
endif
|
|
||||||
|
|
||||||
call writefile(bookmarkStrings, g:NERDTreeBookmarksFile)
|
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
|
endfunction
|
||||||
|
|
||||||
" vim: set sw=4 sts=4 et fdm=marker:
|
" vim: set sw=4 sts=4 et fdm=marker:
|
||||||
|
|||||||
Reference in New Issue
Block a user