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

FreeBSD: Use the same path as Linux

Since FreeBSD is unix based we also use the concept of $HOME.
Use the same include and code as Linux.

Signed-off-by: Emmanuel Vadot <manu@freebsd.org>
This commit is contained in:
Emmanuel Vadot 2020-01-10 22:37:26 +01:00 committed by Ethan Lee
parent 3f3ea6eac7
commit 699d8c4590

View file

@ -15,7 +15,7 @@
#include <shlobj.h> #include <shlobj.h>
#define mkdir(a, b) CreateDirectory(a, NULL) #define mkdir(a, b) CreateDirectory(a, NULL)
#define VNEEDS_MIGRATION (mkdirResult != 0) #define VNEEDS_MIGRATION (mkdirResult != 0)
#elif defined(__linux__) || defined(__APPLE__) #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
#include <sys/stat.h> #include <sys/stat.h>
#include <limits.h> #include <limits.h>
#define VNEEDS_MIGRATION (mkdirResult == 0) #define VNEEDS_MIGRATION (mkdirResult == 0)
@ -159,7 +159,7 @@ std::vector<std::string> FILESYSTEM_getLevelDirFileNames()
void PLATFORM_getOSDirectory(char* output) void PLATFORM_getOSDirectory(char* output)
{ {
#if defined(__linux__) #if defined(__linux__) || defined(__FreeBSD__)
const char *homeDir = getenv("XDG_DATA_HOME"); const char *homeDir = getenv("XDG_DATA_HOME");
if (homeDir == NULL) if (homeDir == NULL)
{ {
@ -187,7 +187,7 @@ void PLATFORM_migrateSaveData(char* output)
char oldLocation[MAX_PATH]; char oldLocation[MAX_PATH];
char newLocation[MAX_PATH]; char newLocation[MAX_PATH];
char oldDirectory[MAX_PATH]; char oldDirectory[MAX_PATH];
#if defined(__linux__) || defined(__APPLE__) #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
DIR *dir = NULL; DIR *dir = NULL;
struct dirent *de = NULL; struct dirent *de = NULL;
DIR *subDir = NULL; DIR *subDir = NULL;
@ -200,7 +200,7 @@ void PLATFORM_migrateSaveData(char* output)
return; return;
} }
strcpy(oldDirectory, homeDir); strcpy(oldDirectory, homeDir);
#if defined(__linux__) #if defined(__linux__) || defined(__FreeBSD__)
strcat(oldDirectory, "/.vvvvvv/"); strcat(oldDirectory, "/.vvvvvv/");
#elif defined(__APPLE__) #elif defined(__APPLE__)
strcat(oldDirectory, "/Documents/VVVVVV/"); strcat(oldDirectory, "/Documents/VVVVVV/");