Rework Mac port to be more Linux-like without needing to launch XCode. See

macos/README.txt for information.
This commit is contained in:
Mark K. Kim 2017-11-27 00:56:41 -05:00
parent 34729d4844
commit ea7f013d0d
35 changed files with 164 additions and 11762 deletions

48
src/macos.c Normal file
View file

@ -0,0 +1,48 @@
#include <stdlib.h>
#include "macos.h"
#define MACOS_FONTS_PATH "%s/Library/Fonts"
#define MACOS_PREFERENCES_PATH "%s/Library/Application Support/TuxPaint"
#define MACOS_GLOBAL_PREFERENCES_PATH "/Library/Application Support/TuxPaint"
const char* macos_fontsPath()
{
static char* p = NULL;
if(!p) {
const char* home = getenv("HOME");
p = malloc(strlen(home) + strlen(MACOS_FONTS_PATH) + 1);
if(p) sprintf(p, MACOS_FONTS_PATH, getenv("HOME"));
else perror("macos_fontsPath");
}
return p;
}
const char* macos_preferencesPath()
{
static char* p = NULL;
if(!p) {
const char* home = getenv("HOME");
p = malloc(strlen(home) + strlen(MACOS_PREFERENCES_PATH) + 1);
if(p) sprintf(p, MACOS_PREFERENCES_PATH, getenv("HOME"));
else perror("macos_preferencesPath");
}
return p;
}
const char* macos_globalPreferencesPath()
{
return MACOS_GLOBAL_PREFERENCES_PATH;
}