Explorar o código

add session_dir checks

Marco Hinz %!s(int64=12) %!d(string=hai) anos
pai
achega
f05e0696e6
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      autoload/startify.vim

+ 8 - 0
autoload/startify.vim

@@ -17,6 +17,10 @@ function! startify#get_session_names_as_string(lead, ...) abort
 endfunction
 
 function! startify#save_session(...) abort
+  if !isdirectory(g:startify_session_dir)
+    echo 'The session directory does not exist: '. g:startify_session_dir
+    return
+  endif
   let spath = g:startify_session_dir .'/'. (exists('a:1')
         \ ? a:1
         \ : input('Save under this session name: ', '', 'custom,startify#get_session_names_as_string'))
@@ -34,6 +38,10 @@ function! startify#save_session(...) abort
 endfunction
 
 function! startify#load_session(...) abort
+  if !isdirectory(g:startify_session_dir)
+    echo 'The session directory does not exist: '. g:startify_session_dir
+    return
+  endif
   let spath = g:startify_session_dir .'/'. (exists('a:1')
         \ ? a:1
         \ : input('Load this session: ', '', 'custom,startify#get_session_names_as_string'))