2 Commits

Author SHA1 Message Date
a03053b717 - Minor changes for macos build 2023-01-21 14:08:24 +01:00
3565c02636 - c++11 mode for macos compilation 2023-01-21 14:07:47 +01:00
2 changed files with 6 additions and 23 deletions

View File

@@ -11,13 +11,13 @@ windows_debug:
g++ $(source) -D DEBUG -g -Wall -Os -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer -o "$(executable)_debug.exe" g++ $(source) -D DEBUG -g -Wall -Os -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer -o "$(executable)_debug.exe"
macos: macos:
clang++ $(source) -Wall -Os -ffunction-sections -fdata-sections -lSDL2 -lSDL2_mixer -o "$(executable)" clang++ $(source) -Wall -Os -std=c++11 -ffunction-sections -fdata-sections -lSDL2 -lSDL2_mixer -o "$(executable)"
macos_debug: macos_debug:
clang++ $(source) -D DEBUG -g -Wall -Os -ffunction-sections -fdata-sections -lSDL2 -lSDL2_mixer -o "$(executable)_debug" clang++ $(source) -D DEBUG -g -Wall -Os -std=c++11 -ffunction-sections -fdata-sections -lSDL2 -lSDL2_mixer -o "$(executable)_debug"
macos_bundle: macos_bundle:
clang++ $(source) -D MACOS_BUNDLE -Wall -Os -framework SDL2 -framework SDL2_mixer -F /Library/Frameworks -ffunction-sections -fdata-sections -o mini_bundle -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.12 clang++ $(source) -D MACOS_BUNDLE -Wall -Os -std=c++11 -framework SDL2 -framework SDL2_mixer -F /Library/Frameworks -ffunction-sections -fdata-sections -o mini_bundle -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.12
linux: linux:
g++ $(source) -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lSDL2 -lSDL2_mixer -o "$(executable)" g++ $(source) -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lSDL2 -lSDL2_mixer -o "$(executable)"

View File

@@ -50,7 +50,7 @@ char *resource_folder = NULL;
DATA_File *data_file = NULL; DATA_File *data_file = NULL;
int file_source = SOURCE_FILE; int file_source = SOURCE_FILE;
char scratch[255]; char scratch[255];
std::string config_folder; static std::string config_folder;
std::vector<keyvalue_t> config; std::vector<keyvalue_t> config;
void file_setresourcefilename(const char *str) { void file_setresourcefilename(const char *str) {
@@ -156,7 +156,6 @@ void file_setconfigfolder(const char *foldername)
struct stat st = {0}; struct stat st = {0};
if (stat(config_folder.c_str(), &st) == -1) if (stat(config_folder.c_str(), &st) == -1)
{ {
errno = 0;
#ifdef _WIN32 #ifdef _WIN32
int ret = mkdir(config_folder.c_str()); int ret = mkdir(config_folder.c_str());
#else #else
@@ -165,24 +164,8 @@ void file_setconfigfolder(const char *foldername)
if (ret == -1) if (ret == -1)
{ {
switch (errno) printf("ERROR CREATING CONFIG FOLDER.");
{ exit(EXIT_FAILURE);
case EACCES:
printf("the parent directory does not allow write");
exit(EXIT_FAILURE);
case EEXIST:
printf("pathname already exists");
exit(EXIT_FAILURE);
case ENAMETOOLONG:
printf("pathname is too long");
exit(EXIT_FAILURE);
default:
perror("mkdir");
exit(EXIT_FAILURE);
}
} }
} }
} }