diff --git a/desktop_version/src/FileSystemUtils.cpp b/desktop_version/src/FileSystemUtils.cpp index bf7cbf72..79233e27 100644 --- a/desktop_version/src/FileSystemUtils.cpp +++ b/desktop_version/src/FileSystemUtils.cpp @@ -16,7 +16,12 @@ #if defined(_WIN32) #include #include -#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 @@ -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