acces a la carpeta data en release

This commit is contained in:
2026-04-05 10:20:46 +02:00
parent d598d4fc58
commit 21bb22b63f

View File

@@ -1,3 +1,5 @@
#include <SDL3/SDL.h>
#include <ctime>
#include <string>
@@ -17,6 +19,15 @@ int main(int /*argc*/, char* /*args*/[]) {
// Crea la carpeta de configuració i carrega les opcions
file_setconfigfolder("jailgames/aee");
// Ruta absoluta a data/ basada en la ubicació de l'executable.
// SDL_GetBasePath() detecta automàticament si estem dins d'un .app bundle
// (retorna Contents/Resources/) o en un executable normal (carpeta del binari).
const char* base_path = SDL_GetBasePath();
if (base_path) {
std::string data_path = std::string(base_path) + "data/";
file_setresourcefolder(data_path.c_str());
}
Options::setConfigFile(std::string(file_getconfigfolder()) + "config.yaml");
Options::loadFromFile();