let name = substitute(a:cmd, '\(\S*\).*', '\1', '')
if !exists("s:have_" . name)
" safety check, don't execute anything from the current directory
- let f = fnamemodify(exepath(name), ":p:h") !=# getcwd()
+ let s:tmp_cwd = getcwd()
+ let f = (fnamemodify(exepath(name), ":p:h") !=# s:tmp_cwd
+ \ || (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) != -1 && s:tmp_cwd != '.'))
+ unlet s:tmp_cwd
if !f
echoerr "Warning: NOT executing " .. name .. " from current directory!"
endif
let g:zip_extractcmd= g:zip_unzipcmd
endif
-if fnamemodify(exepath(g:zip_unzipcmd), ":p:h") ==# getcwd()
+let s:tmp_cwd = getcwd()
+if (fnamemodify(exepath(g:zip_unzipcmd), ":p:h") ==# getcwd()
+ \ && (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) == -1 || s:tmp_cwd == '.'))
+ unlet s:tmp_cwd
echoerr "Warning: NOT executing " .. g:zip_unzipcmd .. " from current directory!"
finish
endif
+unlet s:tmp_cwd
+
" ----------------
" Functions: {{{1
" ----------------
" Set this once, globally.
if !exists("perlpath")
" safety check: don't execute perl from current directory
- if executable("perl") && fnamemodify(exepath("perl"), ":p:h") != getcwd()
+ let s:tmp_cwd = getcwd()
+ if executable("perl") && (fnamemodify(exepath("perl"), ":p:h") != s:tmp_cwd
+ \ || (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) != -1 && s:tmp_cwd != '.'))
try
if &shellxquote != '"'
let perlpath = system('perl -e "print join(q/,/,@INC)"')
" current directory and the directory of the current file.
let perlpath = ".,,"
endif
+ unlet s:tmp_cwd
endif
" Append perlpath to the existing path value, if it is set. Since we don't
let cwd = fnameescape(getcwd())
try
exe cd fnameescape(a:root)
- if fnamemodify(exepath('ruby'), ':p:h') ==# cwd
+ let s:tmp_cwd = getcwd()
+ if (fnamemodify(exepath('ruby'), ':p:h') ==# cwd
+ \ && (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) == -1 || s:tmp_cwd == '.'))
let path = []
else
let path = split(system(path_check),',')
endif
+ unlet s:tmp_cwd
exe cd cwd
return path
finally
let &l:define='\v(<fn>|<const>|<var>|^\s*\#\s*define)'
" Safety check: don't execute zip from current directory
+let s:tmp_cwd = getcwd()
if !exists('g:zig_std_dir') && exists('*json_decode') &&
- \ executable('zig') && fnamemodify(exepath("zig"), ":p:h") != getcwd()
+ \ executable('zig') && (fnamemodify(exepath("zig"), ":p:h") != s:tmp_cwd
+ \ || (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) != -1 && s:tmp_cwd != '.'))
silent let s:env = system('zig env')
if v:shell_error == 0
let g:zig_std_dir = json_decode(s:env)['std_dir']
endif
unlet! s:env
endif
+unlet s:tmp_cwd
if exists('g:zig_std_dir')
let &l:path = &l:path . ',' . g:zig_std_dir