public
Created

  • Download Gist
gistfile1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
diff -r 1c6b099ead89 src/eval.c
--- a/src/eval.c Sun May 27 00:37:51 2012 +0200
+++ b/src/eval.c Wed May 30 10:04:56 2012 +0900
@@ -23777,6 +23777,30 @@
*usedlen += 2;
}
+ /* ":f" - expand 8.3 shortname path to long pathname */
+ while (src[*usedlen] == ':' && src[*usedlen + 1] == 'f')
+ {
+ *usedlen += 2;
+#ifdef WIN3264
+#if _WIN32_WINNT >= 0x0500
+ /* Note: don't occur error if _WIN32_WINNT < 0x0500. */
+ if (vim_strchr(*fnamep, '~'))
+ {
+ p = alloc(_MAX_PATH + 1);
+ if (GetLongPathName(*fnamep, p, MAXPATHL))
+ {
+ if (p == NULL)
+ return -1;
+ vim_free(*bufp);
+ *bufp = *fnamep = p;
+ } else
+ vim_free(p);
+ }
+#endif
+#endif
+ }
+
+
/* ":s?pat?foo?" - substitute */
/* ":gs?pat?foo?" - global substitute */
if (src[*usedlen] == ':'
diff -r 1c6b099ead89 src/misc1.c
--- a/src/misc1.c Sun May 27 00:37:51 2012 +0200
+++ b/src/misc1.c Wed May 30 10:04:56 2012 +0900
@@ -4284,7 +4284,7 @@
{
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)
@@ -4310,9 +4310,21 @@
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, '~'))
+ {
+ int usedlen = 0;
+ int flen;
+ char_u *fbuf = NULL;
+ flen = (int)STRLEN(homedir_env);
+ (void)modify_fname(":p:f", &usedlen, &homedir_env,
+ &homedir_env_orig, &flen);
+ homedir_env[STRLEN(homedir_env)-1] = 0;
+ }
#endif
if (homedir_env != NULL && *homedir_env == NUL)
@@ -4370,6 +4382,9 @@
/* if (dstlen == 0) out of space, what to do??? */
*dst = NUL;
+
+ if (homedir_env != homedir_env_orig)
+ vim_free(homedir_env);
}
/*

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.