]> granicus.if.org Git - vim/commitdiff
patch 8.0.1028: MS-Windows: viminfo uses $VIM/_viminfo if $HOME not set v8.0.1028
authorBram Moolenaar <Bram@vim.org>
Thu, 31 Aug 2017 18:42:18 +0000 (20:42 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 31 Aug 2017 18:42:18 +0000 (20:42 +0200)
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:/".

src/ex_cmds.c
src/version.c

index 8b21b81f2a66b5b6b4a57524589d6dd9741d199a..1cb15f204735a1b734c37418432e20273c23b759 100644 (file)
@@ -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. */
index 56803bc047871239196c57780fae0214f70b4544..37afc35012295f953f6aa5bf388282444548e9bb 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1028,
 /**/
     1027,
 /**/