diff --git a/source/director.cpp b/source/director.cpp index da21c0fc..19ad0321 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -29,7 +29,12 @@ Director::Director(int argc, char *argv[]) checkProgramArguments(argc, argv); // Crea la carpeta del sistema donde guardar datos - createSystemFolder(); + createSystemFolder("jailgames"); +#ifndef DEBUG + createSystemFolder("jailgames/jaildoctors_dilemma"); +#else + createSystemFolder("jailgames/jaildoctors_dilemma_debug"); +#endif // Crea el objeto que controla los ficheros de recursos asset = new Asset(executablePath); @@ -410,24 +415,18 @@ bool Director::saveConfig() } // Crea la carpeta del sistema donde guardar datos -void Director::createSystemFolder() +void Director::createSystemFolder(std::string folder) { -#ifdef DEBUG - const std::string folderName = "jaildoctors_dilemma_debug"; -#else - const std::string folderName = "jaildoctors_dilemma"; -#endif - #ifdef _WIN32 - systemFolder = std::string(getenv("APPDATA")) + "/" + folderName; + systemFolder = std::string(getenv("APPDATA")) + "/" + folder; #elif __APPLE__ struct passwd *pw = getpwuid(getuid()); const char *homedir = pw->pw_dir; - systemFolder = std::string(homedir) + "/Library/Application Support/" + folderName; + systemFolder = std::string(homedir) + "/Library/Application Support" + "/" + folder; #elif __linux__ struct passwd *pw = getpwuid(getuid()); const char *homedir = pw->pw_dir; - systemFolder = std::string(homedir) + "/." + folderName; + systemFolder = std::string(homedir) + "/." + folder; #endif struct stat st = {0}; diff --git a/source/director.h b/source/director.h index d7fc8c58..ea361d82 100644 --- a/source/director.h +++ b/source/director.h @@ -69,7 +69,7 @@ private: bool saveConfig(); // Crea la carpeta del sistema donde guardar datos - void createSystemFolder(); + void createSystemFolder(std::string folder); // Carga los recursos void loadResources(section_t *section);