Skip to content

Instantly share code, notes, and snippets.

@mattn
Created May 30, 2012 01:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/2832022 to your computer and use it in GitHub Desktop.
Save mattn/2832022 to your computer and use it in GitHub Desktop.
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:11:21 2012 +0900
@@ -23560,6 +23560,25 @@
return -1;
}
+#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 (p)
+ {
+ 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))
{
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:11:21 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", &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