diff --git a/source/director.cpp b/source/director.cpp index a993ea4..238b97c 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -25,7 +25,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/coffee_crisis"); +#else + createSystemFolder("jailgames/coffee_crisis_debug"); +#endif // Crea el objeto que controla los ficheros de recursos asset = new Asset(executablePath); @@ -411,24 +416,18 @@ void Director::checkProgramArguments(int argc, char *argv[]) } // Crea la carpeta del sistema donde guardar datos -void Director::createSystemFolder() +void Director::createSystemFolder(std::string folder) { -#ifdef DEBUG - const std::string folderName = "coffee_crisis_debug"; -#else - const std::string folderName = "coffee_crisis"; -#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 5094bd1..fa89f8f 100644 --- a/source/director.h +++ b/source/director.h @@ -81,7 +81,7 @@ private: void checkProgramArguments(int argc, char *argv[]); // Crea la carpeta del sistema donde guardar datos - void createSystemFolder(); + void createSystemFolder(std::string folder); // Establece el valor de la variable void setSection(section_t section);