macOS: Have the support directory be in Application support.

This commit is contained in:
C.W. Betts 2021-05-22 11:43:49 -06:00
commit 4ebf9ec427

View file

@ -50,6 +50,8 @@
#include <fcntl.h>
#include <unistd.h>
#undef pause
#include <sys/types.h>
#include <sys/stat.h>
#endif
extern void creatediscimage_open(void *hwnd);
@ -241,6 +243,20 @@ void get_pcem_path(char *s, int size)
#ifdef __linux
wx_get_home_directory(s);
strcat(s, ".pcem/");
#elif defined(__APPLE__)
/*TODO: Use CoreFoundation functions to get proper directory, in case
the Application Support directory is different (I.E., with signing)*/
wx_get_home_directory(s);
strcat(s, "Library/Application Support/PCem/");
struct stat st = {0};
// create ~/Library/Application Support/PCem/
// if it doesn't exist
if (stat(s, &st) == -1)
{
mkdir(s, 0700);
}
#else
char* path = SDL_GetBasePath();
strcpy(s, path);