mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-09 10:29:45 +01:00
Revert to my old userdata folder creation code.
PhysFS requires a write dir to create a directory, so the first PHYSFS_mkdir never could have worked. Because of that we need to go back to the old mkdir, and since we're bringing that back we can reuse it for saves/levels, because we know it works and we don't have to worry about middlewares ruining anything.
This commit is contained in:
parent
aa97a5d6a1
commit
2f0a0bce4c
1 changed files with 8 additions and 7 deletions
|
@ -16,11 +16,14 @@
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
|
#define mkdir(a, b) CreateDirectory(a, NULL)
|
||||||
|
#define VNEEDS_MIGRATION (mkdirResult != 0)
|
||||||
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__) || defined(__DragonFly__)
|
#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__) || defined(__DragonFly__)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#define VNEEDS_MIGRATION (mkdirResult == 0)
|
||||||
#define MAX_PATH PATH_MAX
|
#define MAX_PATH PATH_MAX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -80,24 +83,21 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath)
|
||||||
PLATFORM_getOSDirectory(output);
|
PLATFORM_getOSDirectory(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create base user directory, mount */
|
/* Create base user directory (NOT with PhysFS!), mount */
|
||||||
mkdirResult = PHYSFS_mkdir(output);
|
mkdirResult = mkdir(output, 777);
|
||||||
|
|
||||||
/* 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);
|
||||||
printf("Base directory: %s\n", output);
|
printf("Base directory: %s\n", output);
|
||||||
|
|
||||||
/* Create the save/level folders */
|
|
||||||
mkdirResult |= PHYSFS_mkdir("saves");
|
|
||||||
mkdirResult |= 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",
|
||||||
output,
|
output,
|
||||||
"saves",
|
"saves",
|
||||||
pathSep
|
pathSep
|
||||||
);
|
);
|
||||||
|
mkdir(saveDir, 0777); /* FIXME: Why did I not | this? -flibit */
|
||||||
printf("Save directory: %s\n", saveDir);
|
printf("Save directory: %s\n", saveDir);
|
||||||
|
|
||||||
/* Store full level directory */
|
/* Store full level directory */
|
||||||
|
@ -106,10 +106,11 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath)
|
||||||
"levels",
|
"levels",
|
||||||
pathSep
|
pathSep
|
||||||
);
|
);
|
||||||
|
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! */
|
||||||
if (mkdirResult == 0)
|
if (VNEEDS_MIGRATION)
|
||||||
{
|
{
|
||||||
PLATFORM_migrateSaveData(output);
|
PLATFORM_migrateSaveData(output);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue