On MS-Windows it only checks if the file exists and is not a
directory, not if it's really executable.
On MS-Windows an executable in the same directory as Vim is
- always found. Since this directory is added to $PATH it
- should also work to execute it |win32-PATH|.
+ normally found. Since this directory is added to $PATH it
+ should also work to execute it |win32-PATH|. This can be
+ disabled by setting the $NoDefaultCurrentDirectoryInExePath
+ environment variable. *NoDefaultCurrentDirectoryInExePath*
The result is a Number:
1 exists
0 does not exist
endif
endfunc
+" Test for exepath()
+func Test_exepath()
+ if has('win32')
+ call assert_notequal(exepath('cmd'), '')
+
+ let oldNoDefaultCurrentDirectoryInExePath = $NoDefaultCurrentDirectoryInExePath
+ call writefile(['@echo off', 'echo Evil'], 'vim-test-evil.bat')
+ let $NoDefaultCurrentDirectoryInExePath = ''
+ call assert_notequal(exepath("vim-test-evil.bat"), '')
+ let $NoDefaultCurrentDirectoryInExePath = '1'
+ call assert_equal(exepath("vim-test-evil.bat"), '')
+ let $NoDefaultCurrentDirectoryInExePath = oldNoDefaultCurrentDirectoryInExePath
+ call delete('vim-test-evil.bat')
+ else
+ call assert_notequal(exepath('sh'), '')
+ endif
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab