changeset 11060:354593196e20 v8.0.0419

patch 8.0.0419: test for v:progpath fails on MS-Windows commit https://github.com/vim/vim/commit/066029ef92b45dc4bd21a353b1fac25841062c26 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 5 15:19:32 2017 +0100 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.
author Christian Brabandt <cb@256bit.org>
date Sun, 05 Mar 2017 15:30:04 +0100
parents 8487f5003690
children 0f11b92d7f5e
files src/main.c src/os_win32.c src/version.c
diffstat 3 files changed, 21 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.c
+++ b/src/main.c
@@ -3533,31 +3533,30 @@ time_msg(
 set_progpath(char_u *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",
      * turn it into a full path.
-     * On MS-Windows "vim.exe" is found in the current directory, thus also do
-     * it when there is no path and the file exists. */
+     * On MS-Windows "vim" should be expanded to "vim.exe", thus always do
+     * this. */
+# ifdef WIN32
+    char_u *path = NULL;
+
+    if (mch_can_exe(argv0, &path, FALSE) && path != NULL)
+	val = path;
+# else
+    char_u buf[MAXPATHL];
+
     if (!mch_isFullName(argv0))
     {
-# ifdef WIN32
-	if (mch_can_exe(argv0, &path, FALSE) && path != NULL)
-	    val = path;
-# else
 	if (gettail(argv0) != argv0
 			   && vim_FullName(argv0, buf, MAXPATHL, TRUE) != FAIL)
 	    val = buf;
+    }
 # endif
-    }
     set_vim_var_string(VV_PROGPATH, val, -1);
-#ifdef WIN32
+# ifdef WIN32
     vim_free(path);
-#endif
+# endif
 }
 
 #endif /* NO_VIM_MAIN */
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -1921,7 +1921,12 @@ executable_exists(char *name, char_u **p
 	if (mch_getperm(name) != -1 && !mch_isdir(name))
 	{
 	    if (path != NULL)
-		*path = vim_strsave((char_u *)name);
+	    {
+		if (mch_isFullName(name))
+		    *path = vim_strsave((char_u *)name);
+		else
+		    *path = FullName_save((char_u *)name, FALSE);
+	    }
 	    return TRUE;
 	}
 	return FALSE;
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    419,
+/**/
     418,
 /**/
     417,