Kaynağa Gözat

Avoid '&&' in system()

I assumed that every shell would support '&&'. Apparently this is not the case
for Fish: it uses 'and'...

Anyway, the simple solution is to avoid cd'ing in the proper directory first
and just using absolute paths for ln instead.

References #165.
Marco Hinz 10 yıl önce
ebeveyn
işleme
295fe7a09a
1 değiştirilmiş dosya ile 4 ekleme ve 2 silme
  1. 4 2
      autoload/startify.vim

+ 4 - 2
autoload/startify.vim

@@ -759,8 +759,10 @@ endfunction
 " Function: s:create_last_session_link {{{1
 function! s:create_last_session_link(spath)
   if !has('win32') && a:spath !~# '__LAST__$'
-    silent! call system('cd '. shellescape(s:session_dir)
-          \ .' && ln -sf '. shellescape(fnamemodify(a:spath, ':t')) .' __LAST__')
+    let cmd = printf('ln -sf %s %s',
+          \ shellescape(a:spath),
+          \ shellescape(fnamemodify(a:spath, ':h') .'/__LAST__'))
+    silent! call system(cmd)
     if v:shell_error
       echomsg "startify: Can't create 'last used session' symlink."
     endif