Fix: Buscar resources.pack relativo al ejecutable, no al working directory
- Movido getExecutableDirectory() a defines.h como función inline - Actualizado main.cpp para construir path absoluto a resources.pack - Eliminadas definiciones duplicadas en engine.cpp y main.cpp - Ahora funciona correctamente ejecutando desde cualquier carpeta (ej. build/) TEST confirmado: - Ejecutar desde raíz: ✅ Carga resources.pack - Ejecutar desde build/: ✅ Carga resources.pack 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -35,18 +35,7 @@
|
||||
#include "shapes/torus_shape.h" // for TorusShape
|
||||
#include "shapes/wave_grid_shape.h" // for WaveGridShape
|
||||
|
||||
// Función auxiliar para obtener la ruta del directorio del ejecutable
|
||||
std::string getExecutableDirectory() {
|
||||
#ifdef _WIN32
|
||||
char buffer[MAX_PATH];
|
||||
GetModuleFileNameA(NULL, buffer, MAX_PATH);
|
||||
std::filesystem::path exe_path(buffer);
|
||||
return exe_path.parent_path().string();
|
||||
#else
|
||||
// Para Linux/macOS se podría usar readlink("/proc/self/exe") o dladdr
|
||||
return "."; // Fallback para otros sistemas
|
||||
#endif
|
||||
}
|
||||
// getExecutableDirectory() ya está definido en defines.h como inline
|
||||
|
||||
// Implementación de métodos públicos
|
||||
bool Engine::initialize(int width, int height, int zoom, bool fullscreen) {
|
||||
|
||||
Reference in New Issue
Block a user