mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-10 19:09:45 +01:00
Replace mkdir with PHYSFS_mkdir
This commit is contained in:
parent
c2c0644453
commit
f815b1ee62
1 changed files with 7 additions and 15 deletions
|
@ -18,24 +18,16 @@
|
|||
|
||||
#include "tinyxml2.h"
|
||||
|
||||
/* These are needed for PLATFORM_* crap */
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
#include <shellapi.h>
|
||||
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 <sys/stat.h>
|
||||
#include <limits.h>
|
||||
#define VNEEDS_MIGRATION (mkdirResult == 0)
|
||||
/* These are needed for PLATFORM_* crap */
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <limits.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <spawn.h>
|
||||
|
@ -75,7 +67,7 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath)
|
|||
}
|
||||
|
||||
/* Create base user directory, mount */
|
||||
mkdirResult = mkdir(output, 0777);
|
||||
mkdirResult = PHYSFS_mkdir(output);
|
||||
|
||||
/* Mount our base user directory */
|
||||
PHYSFS_mount(output, NULL, 0);
|
||||
|
@ -86,18 +78,18 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath)
|
|||
strcpy(saveDir, output);
|
||||
strcat(saveDir, "saves");
|
||||
strcat(saveDir, PHYSFS_getDirSeparator());
|
||||
mkdir(saveDir, 0777);
|
||||
PHYSFS_mkdir(saveDir);
|
||||
printf("Save directory: %s\n", saveDir);
|
||||
|
||||
/* Create level directory */
|
||||
strcpy(levelDir, output);
|
||||
strcat(levelDir, "levels");
|
||||
strcat(levelDir, PHYSFS_getDirSeparator());
|
||||
mkdirResult |= mkdir(levelDir, 0777);
|
||||
mkdirResult |= PHYSFS_mkdir(levelDir);
|
||||
printf("Level directory: %s\n", levelDir);
|
||||
|
||||
/* We didn't exist until now, migrate files! */
|
||||
if (VNEEDS_MIGRATION)
|
||||
if (mkdirResult != 0)
|
||||
{
|
||||
PLATFORM_migrateSaveData(output);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue