summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-03-05 15:19:32 +0100
committerBram Moolenaar <Bram@vim.org>2017-03-05 15:19:32 +0100
commit066029ef92b45dc4bd21a353b1fac25841062c26 (patch)
treecc015c811077be548eb1bb6be0bbf0da28f4d154 /src/main.c
parenta382868115e8f8e44c6a85bb9587f8eb31fa0033 (diff)
downloadvim-066029ef92b45dc4bd21a353b1fac25841062c26.zip
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.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c
index 8669e33a0..0f9f3fff4 100644
--- 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. */
- if (!mch_isFullName(argv0))
- {
+ * On MS-Windows "vim" should be expanded to "vim.exe", thus always do
+ * this. */
# ifdef WIN32
- if (mch_can_exe(argv0, &path, FALSE) && path != NULL)
- val = path;
+ char_u *path = NULL;
+
+ if (mch_can_exe(argv0, &path, FALSE) && path != NULL)
+ val = path;
# else
+ char_u buf[MAXPATHL];
+
+ if (!mch_isFullName(argv0))
+ {
if (gettail(argv0) != argv0
&& vim_FullName(argv0, buf, MAXPATHL, TRUE) != FAIL)
val = buf;
-# endif
}
+# endif
set_vim_var_string(VV_PROGPATH, val, -1);
-#ifdef WIN32
+# ifdef WIN32
vim_free(path);
-#endif
+# endif
}
#endif /* NO_VIM_MAIN */