Actualitzat createSystemFolder a la nova ruta de Linux

This commit is contained in:
2025-02-17 18:20:35 +01:00
parent 78f858831f
commit 424c243ffc
2 changed files with 20 additions and 12 deletions

View File

@@ -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
// 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_SOFTWARE;
//Uint32 flags = SDL_RENDERER_ACCELERATED; // Uint32 flags = SDL_RENDERER_ACCELERATED;
Uint32 flags = 0; Uint32 flags = 0;
if (options->vSync) if (options->vSync)
{ {
flags = flags | SDL_RENDERER_PRESENTVSYNC; flags = flags | SDL_RENDERER_PRESENTVSYNC;
} }
renderer = SDL_CreateRenderer(window, -1, flags); renderer = SDL_CreateRenderer(window, -1, flags);
if (renderer == nullptr) if (renderer == nullptr)
@@ -435,7 +435,7 @@ void Director::checkProgramArguments(int argc, char *argv[])
} }
// Crea la carpeta del sistema donde guardar datos // Crea la carpeta del sistema donde guardar datos
void Director::createSystemFolder(std::string folder) void Director::createSystemFolder(const std::string &folder)
{ {
#ifdef _WIN32 #ifdef _WIN32
systemFolder = std::string(getenv("APPDATA")) + "/" + folder; systemFolder = std::string(getenv("APPDATA")) + "/" + folder;
@@ -446,7 +446,18 @@ void Director::createSystemFolder(std::string folder)
#elif __linux__ #elif __linux__
struct passwd *pw = getpwuid(getuid()); struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir; 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 #endif
struct stat st = {0}; struct stat st = {0};
@@ -741,7 +752,7 @@ void Director::initOnline()
#else #else
const std::string caption = options->online.jailerID; const std::string caption = options->online.jailerID;
#endif #endif
//screen->showNotification(caption, lang->getText(85), 12); // screen->showNotification(caption, lang->getText(85), 12);
screen->showNotification(caption, lang->getText(85)); screen->showNotification(caption, lang->getText(85));
if (options->console) if (options->console)
{ {

View File

@@ -81,10 +81,7 @@ private:
void checkProgramArguments(int argc, char *argv[]); void checkProgramArguments(int argc, char *argv[]);
// Crea la carpeta del sistema donde guardar datos // Crea la carpeta del sistema donde guardar datos
void createSystemFolder(std::string folder); void createSystemFolder(const std::string &folder);
// Establece el valor de la variable
void setSection(section_t section);
// Ejecuta la seccion de juego con el logo // Ejecuta la seccion de juego con el logo
void runLogo(); void runLogo();