0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.0.0419: test for v:progpath fails on MS-Windows

Problem:    Test for v:progpath fails on MS-Windows.
Solution:   Expand to full path.  Also add ".exe" when the path is an absolute
            path.
This commit is contained in:
Bram Moolenaar 2017-03-05 15:19:32 +01:00
parent a382868115
commit 066029ef92
3 changed files with 21 additions and 15 deletions

View File

@ -3533,27 +3533,26 @@ time_msg(
set_progpath(char_u *argv0) set_progpath(char_u *argv0)
{ {
char_u *val = argv0; char_u *val = argv0;
#ifdef WIN32
char_u *path = NULL;
#else
char_u buf[MAXPATHL];
#endif
/* A relative path containing a "/" will become invalid when using ":cd", /* A relative path containing a "/" will become invalid when using ":cd",
* turn it into a full path. * turn it into a full path.
* On MS-Windows "vim.exe" is found in the current directory, thus also do * On MS-Windows "vim" should be expanded to "vim.exe", thus always do
* it when there is no path and the file exists. */ * this. */
if (!mch_isFullName(argv0))
{
# ifdef WIN32 # ifdef WIN32
char_u *path = NULL;
if (mch_can_exe(argv0, &path, FALSE) && path != NULL) if (mch_can_exe(argv0, &path, FALSE) && path != NULL)
val = path; val = path;
# else # else
char_u buf[MAXPATHL];
if (!mch_isFullName(argv0))
{
if (gettail(argv0) != argv0 if (gettail(argv0) != argv0
&& vim_FullName(argv0, buf, MAXPATHL, TRUE) != FAIL) && vim_FullName(argv0, buf, MAXPATHL, TRUE) != FAIL)
val = buf; val = buf;
# endif
} }
# endif
set_vim_var_string(VV_PROGPATH, val, -1); set_vim_var_string(VV_PROGPATH, val, -1);
# ifdef WIN32 # ifdef WIN32
vim_free(path); vim_free(path);

View File

@ -1921,7 +1921,12 @@ executable_exists(char *name, char_u **path, int use_path)
if (mch_getperm(name) != -1 && !mch_isdir(name)) if (mch_getperm(name) != -1 && !mch_isdir(name))
{ {
if (path != NULL) if (path != NULL)
{
if (mch_isFullName(name))
*path = vim_strsave((char_u *)name); *path = vim_strsave((char_u *)name);
else
*path = FullName_save((char_u *)name, FALSE);
}
return TRUE; return TRUE;
} }
return FALSE; return FALSE;

View File

@ -764,6 +764,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 */
/**/
419,
/**/ /**/
418, 418,
/**/ /**/