mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Re-fix handling filepaths with non-ASCII characters on Windows
In #52 I fixed VVVVVV not being able to handle filepaths with non-ASCII characters on Windows.2f0a0bce4c
andaa5c2d9dc2
reintroduce this problem, however, by reverting the definition of mkdir to how it was before the fix and using the non-Unicode version of CreateDirectory. And I can confirm that VVVVVV indeed doesn't make its folder anymore with a Windows username of "тест". This commit fixes that issue.
This commit is contained in:
parent
e8316c7e9a
commit
274ae98915
1 changed files with 7 additions and 2 deletions
|
@ -16,7 +16,12 @@
|
|||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
#define mkdir(a, b) CreateDirectory(a, NULL)
|
||||
int mkdir(char* path, int mode)
|
||||
{
|
||||
WCHAR utf16_path[MAX_PATH];
|
||||
MultiByteToWideChar(CP_UTF8, 0, path, -1, utf16_path, MAX_PATH);
|
||||
return CreateDirectoryW(utf16_path, NULL);
|
||||
}
|
||||
#define VNEEDS_MIGRATION (mkdirResult != 0)
|
||||
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__) || defined(__DragonFly__)
|
||||
#include <unistd.h>
|
||||
|
@ -585,7 +590,7 @@ static void PLATFORM_getOSDirectory(char* output)
|
|||
SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, utf16_path);
|
||||
WideCharToMultiByte(CP_UTF8, 0, utf16_path, -1, output, MAX_PATH, NULL, NULL);
|
||||
SDL_strlcat(output, "\\VVVVVV\\", MAX_PATH);
|
||||
CreateDirectory(output, NULL);
|
||||
mkdir(output, 0);
|
||||
#else
|
||||
SDL_strlcpy(output, PHYSFS_getPrefDir("distractionware", "VVVVVV"), MAX_PATH);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue