patch 8.0.1028: MS-Windows: viminfo uses $VIM/_viminfo if $HOME not set
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:/".
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 8b21b81..1cb15f2 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -2098,11 +2098,16 @@
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. */
diff --git a/src/version.c b/src/version.c
index 56803bc..37afc35 100644
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1028,
+/**/
1027,
/**/
1026,