1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Only migrate savedata if "saves" was created

This commit is contained in:
Ethan Lee 2021-04-11 11:19:49 -04:00 committed by GitHub
parent bc0b9e1fa0
commit fcb09f85cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,7 +55,7 @@ static const PHYSFS_Allocator allocator = {
int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath) int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath)
{ {
char output[MAX_PATH]; char output[MAX_PATH];
int mkdirResult; int saveDirCreated;
int retval; int retval;
const char* pathSep = PHYSFS_getDirSeparator(); const char* pathSep = PHYSFS_getDirSeparator();
char* basePath; char* basePath;
@ -81,7 +81,7 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath)
} }
/* Create base user directory, mount */ /* Create base user directory, mount */
mkdirResult = PHYSFS_mkdir(output); PHYSFS_mkdir(output);
/* Mount our base user directory */ /* Mount our base user directory */
PHYSFS_mount(output, NULL, 0); PHYSFS_mount(output, NULL, 0);
@ -89,8 +89,8 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath)
printf("Base directory: %s\n", output); printf("Base directory: %s\n", output);
/* Create the save/level folders */ /* Create the save/level folders */
mkdirResult |= PHYSFS_mkdir("saves"); saveDirCreated = PHYSFS_mkdir("saves");
mkdirResult |= PHYSFS_mkdir("levels"); PHYSFS_mkdir("levels");
/* Store full save directory */ /* Store full save directory */
SDL_snprintf(saveDir, sizeof(saveDir), "%s%s%s", SDL_snprintf(saveDir, sizeof(saveDir), "%s%s%s",
@ -109,7 +109,7 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath)
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! */
if (mkdirResult == 0) if (saveDirCreated != 0)
{ {
PLATFORM_migrateSaveData(output); PLATFORM_migrateSaveData(output);
} }