From 21bb22b63fa74434ca695a01d744bcdc486f2d44 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Sun, 5 Apr 2026 10:20:46 +0200 Subject: [PATCH] acces a la carpeta data en release --- source/main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/main.cpp b/source/main.cpp index 59d45bf..a1134f7 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,3 +1,5 @@ +#include + #include #include @@ -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();