mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.1.1090: MS-Windows: modify_fname() has problems with some 'encoding'
Problem: MS-Windows: modify_fname() has problems with some 'encoding'. Solution: Use GetLongPathNameW() instead of GetLongPathName(). (Ken Takata, closes #4007)
This commit is contained in:
26
src/eval.c
26
src/eval.c
@@ -10321,19 +10321,25 @@ repeat:
|
|||||||
# if _WIN32_WINNT >= 0x0500
|
# if _WIN32_WINNT >= 0x0500
|
||||||
if (vim_strchr(*fnamep, '~') != NULL)
|
if (vim_strchr(*fnamep, '~') != NULL)
|
||||||
{
|
{
|
||||||
/* Expand 8.3 filename to full path. Needed to make sure the same
|
// Expand 8.3 filename to full path. Needed to make sure the same
|
||||||
* file does not have two different names.
|
// file does not have two different names.
|
||||||
* Note: problem does not occur if _WIN32_WINNT < 0x0500. */
|
// Note: problem does not occur if _WIN32_WINNT < 0x0500.
|
||||||
p = alloc(_MAX_PATH + 1);
|
WCHAR *wfname = enc_to_utf16(*fnamep, NULL);
|
||||||
if (p != NULL)
|
WCHAR buf[_MAX_PATH];
|
||||||
|
|
||||||
|
if (wfname != NULL)
|
||||||
{
|
{
|
||||||
if (GetLongPathName((LPSTR)*fnamep, (LPSTR)p, _MAX_PATH))
|
if (GetLongPathNameW(wfname, buf, _MAX_PATH))
|
||||||
{
|
{
|
||||||
vim_free(*bufp);
|
char_u *p = utf16_to_enc(buf, NULL);
|
||||||
*bufp = *fnamep = p;
|
|
||||||
|
if (p != NULL)
|
||||||
|
{
|
||||||
|
vim_free(*bufp); // free any allocated file name
|
||||||
|
*bufp = *fnamep = p;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
vim_free(wfname);
|
||||||
vim_free(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
@@ -775,6 +775,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 */
|
||||||
|
/**/
|
||||||
|
1090,
|
||||||
/**/
|
/**/
|
||||||
1089,
|
1089,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user