diff --git a/source/director.cpp b/source/director.cpp index 28fa105..1a2ad1c 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -187,13 +187,13 @@ bool Director::initSDL() { // Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones // Crea un renderizador para la ventana. El vsync se activa en funcion de las opciones - //Uint32 flags = SDL_RENDERER_SOFTWARE; - //Uint32 flags = SDL_RENDERER_ACCELERATED; + // Uint32 flags = SDL_RENDERER_SOFTWARE; + // Uint32 flags = SDL_RENDERER_ACCELERATED; Uint32 flags = 0; if (options->vSync) - { - flags = flags | SDL_RENDERER_PRESENTVSYNC; - } + { + flags = flags | SDL_RENDERER_PRESENTVSYNC; + } renderer = SDL_CreateRenderer(window, -1, flags); if (renderer == nullptr) @@ -435,7 +435,7 @@ void Director::checkProgramArguments(int argc, char *argv[]) } // Crea la carpeta del sistema donde guardar datos -void Director::createSystemFolder(std::string folder) +void Director::createSystemFolder(const std::string &folder) { #ifdef _WIN32 systemFolder = std::string(getenv("APPDATA")) + "/" + folder; @@ -446,7 +446,18 @@ void Director::createSystemFolder(std::string folder) #elif __linux__ struct passwd *pw = getpwuid(getuid()); const char *homedir = pw->pw_dir; - systemFolder = std::string(homedir) + "/." + folder; + systemFolder = std::string(homedir) + "/.config/" + folder; + + { + // Intenta crear ".config", per si no existeix + std::string config_base_folder = std::string(homedir) + "/.config"; + int ret = mkdir(config_base_folder.c_str(), S_IRWXU); + if (ret == -1 && errno != EEXIST) + { + printf("ERROR CREATING CONFIG BASE FOLDER."); + exit(EXIT_FAILURE); + } + } #endif struct stat st = {0}; @@ -741,7 +752,7 @@ void Director::initOnline() #else const std::string caption = options->online.jailerID; #endif - //screen->showNotification(caption, lang->getText(85), 12); + // screen->showNotification(caption, lang->getText(85), 12); screen->showNotification(caption, lang->getText(85)); if (options->console) { diff --git a/source/director.h b/source/director.h index a9594ed..89da7c8 100644 --- a/source/director.h +++ b/source/director.h @@ -81,10 +81,7 @@ private: void checkProgramArguments(int argc, char *argv[]); // Crea la carpeta del sistema donde guardar datos - void createSystemFolder(std::string folder); - - // Establece el valor de la variable - void setSection(section_t section); + void createSystemFolder(const std::string &folder); // Ejecuta la seccion de juego con el logo void runLogo();