]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.3.559 v7.3.559
authorBram Moolenaar <Bram@vim.org>
Wed, 20 Jun 2012 12:02:27 +0000 (14:02 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 20 Jun 2012 12:02:27 +0000 (14:02 +0200)
Problem:    home_replace() does not work with 8.3 filename.
Solution:   Make ":p" expand 8.3 name to full path. (Yasuhiro Matsumoto)

src/eval.c
src/misc1.c
src/version.c

index d238dc2badba32d9cfd174f648f72a16716b21a2..83e2016f16447bea621603128a133098855cc6bb 100644 (file)
@@ -23554,6 +23554,27 @@ repeat:
                return -1;
        }
 
+#ifdef WIN3264
+# if _WIN32_WINNT >= 0x0500
+       if (vim_strchr(*fnamep, '~') != NULL)
+       {
+           /* Expand 8.3 filename to full path.  Needed to make sure the same
+            * file does not have two different names.
+            * Note: problem does not occur if _WIN32_WINNT < 0x0500. */
+           p = alloc(_MAX_PATH + 1);
+           if (p != NULL)
+           {
+               if (GetLongPathName(*fnamep, p, MAXPATHL))
+               {
+                   vim_free(*bufp);
+                   *bufp = *fnamep = p;
+               }
+               else
+                   vim_free(p);
+           }
+       }
+# endif
+#endif
        /* Append a path separator to a directory. */
        if (mch_isdir(*fnamep))
        {
index 10a0fc0659880696df20d32d20f23eedaa0d6f24..80e7fa693db0390dc88ae431b263265c124bc0fe 100644 (file)
@@ -4499,7 +4499,7 @@ home_replace(buf, src, dst, dstlen, one)
 {
     size_t     dirlen = 0, envlen = 0;
     size_t     len;
-    char_u     *homedir_env;
+    char_u     *homedir_env, *homedir_env_orig;
     char_u     *p;
 
     if (src == NULL)
@@ -4525,9 +4525,24 @@ home_replace(buf, src, dst, dstlen, one)
        dirlen = STRLEN(homedir);
 
 #ifdef VMS
-    homedir_env = mch_getenv((char_u *)"SYS$LOGIN");
+    homedir_env_orig = homedir_env = mch_getenv((char_u *)"SYS$LOGIN");
 #else
-    homedir_env = mch_getenv((char_u *)"HOME");
+    homedir_env_orig = homedir_env = mch_getenv((char_u *)"HOME");
+#endif
+#if defined(FEAT_MODIFY_FNAME) || defined(WIN3264)
+    if (vim_strchr(homedir_env, '~') != NULL)
+    {
+       int     usedlen = 0;
+       int     flen;
+       char_u  *fbuf = NULL;
+
+       flen = (int)STRLEN(homedir_env);
+       (void)modify_fname(":p", &usedlen, &homedir_env, &fbuf, &flen);
+       flen = (int)STRLEN(homedir_env);
+       if (flen > 0 && vim_ispathsep(homedir_env[flen - 1]))
+           /* Remove the trailing / that is added to a directory. */
+           homedir_env[flen - 1] = NUL;
+    }
 #endif
 
     if (homedir_env != NULL && *homedir_env == NUL)
@@ -4585,6 +4600,9 @@ home_replace(buf, src, dst, dstlen, one)
     /* if (dstlen == 0) out of space, what to do??? */
 
     *dst = NUL;
+
+    if (homedir_env != homedir_env_orig)
+       vim_free(homedir_env);
 }
 
 /*
index 2378abb40cc199a6cf6aa28c6deaabbd624fcde2..2f09e4be22ca3854e349d169a2ae054059028aa9 100644 (file)
@@ -714,6 +714,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    559,
 /**/
     558,
 /**/