From adab0b420cb4dca8a2eded2526b2ea19e205ef64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Valor=20Mart=C3=ADnez?= Date: Sun, 12 Feb 2023 18:05:53 +0100 Subject: [PATCH] - Modificada la carpeta de guardar datos al estandar de jailgames --- source/director.cpp | 21 ++++++++++----------- source/director.h | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/source/director.cpp b/source/director.cpp index da21c0f..19ad032 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 d7fc8c5..ea361d8 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);