Created
May 30, 2012 01:05
-
-
Save mattn/2831996 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
/* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment