0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.1.0294: MS-Windows: sometimes uses short directory name

Problem:    MS-Windows: sometimes uses short directory name.
Solution:   Expand to long file name with correct caps. (Nobuhiro Takasaki,
            closes #3334)
This commit is contained in:
Bram Moolenaar 2018-08-18 20:20:27 +02:00
parent 4d77c65a9e
commit 3b9fcfcffa
2 changed files with 19 additions and 2 deletions

View File

@ -3108,6 +3108,8 @@ mch_dirname(
char_u *buf, char_u *buf,
int len) int len)
{ {
char_u abuf[_MAX_PATH + 1];
/* /*
* Originally this was: * Originally this was:
* return (getcwd(buf, len) != NULL ? OK : FAIL); * return (getcwd(buf, len) != NULL ? OK : FAIL);
@ -3121,7 +3123,13 @@ mch_dirname(
if (GetCurrentDirectoryW(_MAX_PATH, wbuf) != 0) if (GetCurrentDirectoryW(_MAX_PATH, wbuf) != 0)
{ {
char_u *p = utf16_to_enc(wbuf, NULL); WCHAR wcbuf[_MAX_PATH + 1];
char_u *p;
if (GetLongPathNameW(wbuf, wcbuf, _MAX_PATH) != 0)
p = utf16_to_enc(wcbuf, NULL);
else
p = utf16_to_enc(wbuf, NULL);
if (p != NULL) if (p != NULL)
{ {
@ -3133,7 +3141,14 @@ mch_dirname(
return FAIL; return FAIL;
} }
#endif #endif
return (GetCurrentDirectory(len, (LPSTR)buf) != 0 ? OK : FAIL); if (GetCurrentDirectory(len, (LPSTR)buf) == 0)
return FAIL;
if (GetLongPathNameA((LPSTR)buf, (LPSTR)abuf, _MAX_PATH) == 0)
// return the short path name
return OK;
vim_strncpy(abuf, buf, len - 1);
return OK;
} }
/* /*

View File

@ -794,6 +794,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
294,
/**/ /**/
293, 293,
/**/ /**/