forked from jaildesigner-jailgames/jaildoctors_dilemma
PETA QUE NI EL PEPE KARTS
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "resource.h" // Para Resource
|
||||
#include "screen.h" // Para Screen, FILTER_NEAREST, FILTER...
|
||||
#include "utils.h" // Para options_t, section_t, op_notif...
|
||||
#include "notifier.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <pwd.h>
|
||||
@@ -53,15 +54,16 @@ Director::Director(int argc, const char *argv[])
|
||||
#ifdef DEBUG
|
||||
section->name = SECTION_TITLE;
|
||||
#endif
|
||||
|
||||
Asset::init(argv[0]); // Crea el objeto que controla los ficheros de recursos
|
||||
|
||||
// Crea e inicializa las opciones del programa
|
||||
initOptions();
|
||||
|
||||
// Comprueba los parametros del programa
|
||||
checkProgramArguments(argc, argv);
|
||||
|
||||
// Crea el objeto que controla los ficheros de recursos
|
||||
Asset::init(executable_path_);
|
||||
Asset::get()->setVerbose(options->console);
|
||||
|
||||
// Crea la carpeta del sistema donde guardar datos
|
||||
createSystemFolder("jailgames");
|
||||
#ifndef DEBUG
|
||||
@@ -70,9 +72,6 @@ Director::Director(int argc, const char *argv[])
|
||||
createSystemFolder("jailgames/jaildoctors_dilemma_debug");
|
||||
#endif
|
||||
|
||||
// Crea el objeto que controla los ficheros de recursos
|
||||
Asset::get()->setVerbose(options->console);
|
||||
|
||||
// Si falta algún fichero no inicia el programa
|
||||
if (!setFileList())
|
||||
{
|
||||
@@ -91,6 +90,7 @@ Director::Director(int argc, const char *argv[])
|
||||
// Crea los objetos
|
||||
Screen::init(window_, renderer_);
|
||||
Screen::get()->setBorderColor(borderColor);
|
||||
Notifier::init(Asset::get()->get("notify.png"), Asset::get()->get("smb2.png"), Asset::get()->get("smb2.txt"), Asset::get()->get("notify.wav"), options);
|
||||
resource_ = new Resource(options);
|
||||
Input::init(Asset::get()->get("gamecontrollerdb.txt"));
|
||||
initInput();
|
||||
@@ -104,6 +104,10 @@ Director::~Director()
|
||||
saveConfig();
|
||||
|
||||
// Libera la memoria
|
||||
Asset::destroy();
|
||||
Input::destroy();
|
||||
Screen::destroy();
|
||||
Notifier::destroy();
|
||||
delete section;
|
||||
delete options;
|
||||
delete debug_;
|
||||
@@ -416,11 +420,11 @@ void Director::createSystemFolder(const std::string &folder)
|
||||
#elif __APPLE__
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
const char *homedir = pw->pw_dir;
|
||||
systemFolder = std::string(homedir) + "/Library/Application Support" + "/" + folder;
|
||||
system_folder_ = std::string(homedir) + "/Library/Application Support" + "/" + folder;
|
||||
#elif __linux__
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
const char *homedir = pw->pw_dir;
|
||||
systemFolder = std::string(homedir) + "/.config/" + folder;
|
||||
system_folder_ = std::string(homedir) + "/.config/" + folder;
|
||||
|
||||
{
|
||||
// Intenta crear ".config", per si no existeix
|
||||
@@ -441,7 +445,7 @@ void Director::createSystemFolder(const std::string &folder)
|
||||
#ifdef _WIN32
|
||||
int ret = mkdir(system_folder_.c_str());
|
||||
#else
|
||||
int ret = mkdir(systemFolder.c_str(), S_IRWXU);
|
||||
int ret = mkdir(system_folder_.c_str(), S_IRWXU);
|
||||
#endif
|
||||
|
||||
if (ret == -1)
|
||||
|
||||
Reference in New Issue
Block a user