1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-28 23:48:30 +02:00

Move first CreateDirectory to getOSDirectory, avoids redundancy on non-Win32

This commit is contained in:
Ethan Lee 2021-04-11 11:55:35 -04:00
parent 2e630ce06c
commit aa5c2d9dc2

View File

@ -83,9 +83,6 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath)
PLATFORM_getOSDirectory(output); PLATFORM_getOSDirectory(output);
} }
/* Create base user directory (NOT with PhysFS!), mount */
mkdirResult = mkdir(output, 0777);
/* Mount our base user directory */ /* Mount our base user directory */
PHYSFS_mount(output, NULL, 0); PHYSFS_mount(output, NULL, 0);
PHYSFS_setWriteDir(output); PHYSFS_setWriteDir(output);
@ -106,7 +103,7 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath)
"levels", "levels",
pathSep pathSep
); );
mkdirResult |= mkdir(levelDir, 0777); mkdirResult = mkdir(levelDir, 0777);
printf("Level directory: %s\n", levelDir); printf("Level directory: %s\n", levelDir);
/* We didn't exist until now, migrate files! */ /* We didn't exist until now, migrate files! */
@ -588,6 +585,7 @@ static void PLATFORM_getOSDirectory(char* output)
SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, utf16_path); SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, utf16_path);
WideCharToMultiByte(CP_UTF8, 0, utf16_path, -1, output, MAX_PATH, NULL, NULL); WideCharToMultiByte(CP_UTF8, 0, utf16_path, -1, output, MAX_PATH, NULL, NULL);
SDL_strlcat(output, "\\VVVVVV\\", MAX_PATH); SDL_strlcat(output, "\\VVVVVV\\", MAX_PATH);
CreateDirectory(output, NULL);
#else #else
SDL_strlcpy(output, PHYSFS_getPrefDir("distractionware", "VVVVVV"), MAX_PATH); SDL_strlcpy(output, PHYSFS_getPrefDir("distractionware", "VVVVVV"), MAX_PATH);
#endif #endif