- Minor changes for macos build

This commit is contained in:
2023-01-21 14:08:24 +01:00
parent 3565c02636
commit a03053b717

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.");
{
case EACCES:
printf("the parent directory does not allow write");
exit(EXIT_FAILURE); 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);
}
} }
} }
} }