Skip to content

Commit 066029e

Browse files
committed
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.
1 parent a382868 commit 066029e

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

src/main.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3533,31 +3533,30 @@ time_msg(
35333533
set_progpath(char_u *argv0)
35343534
{
35353535
char_u *val = argv0;
3536-
#ifdef WIN32
3537-
char_u *path = NULL;
3538-
#else
3539-
char_u buf[MAXPATHL];
3540-
#endif
35413536

35423537
/* A relative path containing a "/" will become invalid when using ":cd",
35433538
* turn it into a full path.
3544-
* On MS-Windows "vim.exe" is found in the current directory, thus also do
3545-
* it when there is no path and the file exists. */
3546-
if (!mch_isFullName(argv0))
3547-
{
3539+
* On MS-Windows "vim" should be expanded to "vim.exe", thus always do
3540+
* this. */
35483541
# ifdef WIN32
3549-
if (mch_can_exe(argv0, &path, FALSE) && path != NULL)
3550-
val = path;
3542+
char_u *path = NULL;
3543+
3544+
if (mch_can_exe(argv0, &path, FALSE) && path != NULL)
3545+
val = path;
35513546
# else
3547+
char_u buf[MAXPATHL];
3548+
3549+
if (!mch_isFullName(argv0))
3550+
{
35523551
if (gettail(argv0) != argv0
35533552
&& vim_FullName(argv0, buf, MAXPATHL, TRUE) != FAIL)
35543553
val = buf;
3555-
# endif
35563554
}
3555+
# endif
35573556
set_vim_var_string(VV_PROGPATH, val, -1);
3558-
#ifdef WIN32
3557+
# ifdef WIN32
35593558
vim_free(path);
3560-
#endif
3559+
# endif
35613560
}
35623561

35633562
#endif /* NO_VIM_MAIN */

src/os_win32.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,12 @@ executable_exists(char *name, char_u **path, int use_path)
19211921
if (mch_getperm(name) != -1 && !mch_isdir(name))
19221922
{
19231923
if (path != NULL)
1924-
*path = vim_strsave((char_u *)name);
1924+
{
1925+
if (mch_isFullName(name))
1926+
*path = vim_strsave((char_u *)name);
1927+
else
1928+
*path = FullName_save((char_u *)name, FALSE);
1929+
}
19251930
return TRUE;
19261931
}
19271932
return FALSE;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
419,
767769
/**/
768770
418,
769771
/**/

0 commit comments

Comments
 (0)