mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.4860: MS-Windows: always uses current directory for executables
Problem: MS-Windows: always uses current directory for executables. Solution: Check the NoDefaultCurrentDirectoryInExePath environment variable. (Yasuhiro Matsumoto, closes #10341)
This commit is contained in:
parent
3a974a8933
commit
05cf63e9bd
@ -2016,8 +2016,10 @@ executable({expr}) *executable()*
|
|||||||
On MS-Windows it only checks if the file exists and is not a
|
On MS-Windows it only checks if the file exists and is not a
|
||||||
directory, not if it's really executable.
|
directory, not if it's really executable.
|
||||||
On MS-Windows an executable in the same directory as Vim is
|
On MS-Windows an executable in the same directory as Vim is
|
||||||
always found. Since this directory is added to $PATH it
|
normally found. Since this directory is added to $PATH it
|
||||||
should also work to execute it |win32-PATH|.
|
should also work to execute it |win32-PATH|. This can be
|
||||||
|
disabled by setting the $NoDefaultCurrentDirectoryInExePath
|
||||||
|
environment variable. *NoDefaultCurrentDirectoryInExePath*
|
||||||
The result is a Number:
|
The result is a Number:
|
||||||
1 exists
|
1 exists
|
||||||
0 does not exist
|
0 does not exist
|
||||||
|
@ -2237,7 +2237,11 @@ executable_exists(char *name, char_u **path, int use_path, int use_pathext)
|
|||||||
retval = FALSE;
|
retval = FALSE;
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mch_getenv("NoDefaultCurrentDirectoryInExePath") == NULL)
|
||||||
STRCPY(pathbuf, ".;");
|
STRCPY(pathbuf, ".;");
|
||||||
|
else
|
||||||
|
*pathbuf = NUL;
|
||||||
STRCAT(pathbuf, p);
|
STRCAT(pathbuf, p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2906,4 +2906,22 @@ func Test_isabsolutepath()
|
|||||||
endif
|
endif
|
||||||
endfunc
|
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
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4860,
|
||||||
/**/
|
/**/
|
||||||
4859,
|
4859,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user