summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-31 20:42:18 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-31 20:42:18 +0200
commit3d593c2dc97c5426316bf343910cad911b2f6b49 (patch)
tree95faca0525fe5646b88f08d2f0b0b059f09a8cfc /src/ex_cmds.c
parent2db0ec4b2ec405aca4e642e0420ce703f94914a8 (diff)
patch 8.0.1028: MS-Windows: viminfo uses $VIM/_viminfo if $HOME not setv8.0.1028
Problem: MS-Windows: viminfo uses $VIM/_viminfo if $HOME not set. (Yongwei Wu) Solution: Use vim_getenv() but check it's returning the default "C:/".
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 8b21b81f2a..1cb15f2047 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -2098,11 +2098,16 @@ viminfo_filename(char_u *file)
else if ((file = find_viminfo_parameter('n')) == NULL || *file == NUL)
{
#ifdef VIMINFO_FILE2
- /* don't use $HOME when not defined (turned into "c:/"!). */
# ifdef VMS
if (mch_getenv((char_u *)"SYS$LOGIN") == NULL)
# else
+# ifdef MSWIN
+ /* Use $VIM only if $HOME is the default "C:/". */
+ if (STRCMP(vim_getenv((char_u *)"HOME", NULL), "C:/") == 0
+ && mch_getenv((char_u *)"HOME") == NULL)
+# else
if (mch_getenv((char_u *)"HOME") == NULL)
+# endif
# endif
{
/* don't use $VIM when not available. */