Añadida carpeta de sistema para el modo debug
This commit is contained in:
@@ -351,16 +351,22 @@ bool Director::saveConfig()
|
||||
// Crea la carpeta del sistema donde guardar datos
|
||||
void Director::createSystemFolder()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
const std::string folderName = "jaildoctors_dilemma_debug";
|
||||
#else
|
||||
const std::string folderName = "jaildoctors_dilemma";
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
systemFolder = std::string(getenv("APPDATA")) + "/jaildoctors_dilemma";
|
||||
systemFolder = std::string(getenv("APPDATA")) + "/" + folderName;
|
||||
#elif __APPLE__
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
const char *homedir = pw->pw_dir;
|
||||
systemFolder = std::string(homedir) + "/Library/Application Support/jaildoctors_dilemma";
|
||||
systemFolder = std::string(homedir) + "/Library/Application Support/" + folderName;
|
||||
#elif __linux__
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
const char *homedir = pw->pw_dir;
|
||||
systemFolder = std::string(homedir) + "/.jaildoctors_dilemma";
|
||||
systemFolder = std::string(homedir) + "/." + folderName;
|
||||
#endif
|
||||
|
||||
struct stat st = {0};
|
||||
@@ -380,12 +386,15 @@ void Director::createSystemFolder()
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user