Make saving of unicode named files work under Win32

the "Long" name is converted to short (DOS 8.3) name
as soon as possible.
This commit is contained in:
Thomas Bernard
2018-02-16 12:45:07 +01:00
parent 74818299a3
commit ad219c84d2
5 changed files with 47 additions and 1 deletions

View File

@@ -1939,7 +1939,13 @@ byte Button_Load_or_Save(T_Selector_settings *settings, byte load, T_IO_Context
WCHAR temp_str[MAX_PATH_CHARACTERS];
if (GetShortPathNameW((WCHAR *)filename_unicode, temp_str, MAX_PATH_CHARACTERS) == 0)
{
strcpy(filename_ansi, "*TEMP*");
// generate a temporary ansi name
int i;
for (i = 0; i < MAX_PATH_CHARACTERS - 1 && filename_unicode[i] != 0; i++)
{
filename_ansi[i] = (filename_unicode[i] < 256) ? (byte)filename_unicode[i] : '_';
}
filename_ansi[i] = '\0';
}
else
{