From da32b5be1a2730fc56f530a99c1bc405506bc85a Mon Sep 17 00:00:00 2001 From: Gregor Klevze Date: Sun, 30 Nov 2025 14:50:27 +0100 Subject: [PATCH] fixed paths --- src/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 2d2e00f..8b5ba9b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -682,12 +682,11 @@ int main(int, char **) } SDL_SetRenderVSync(renderer, 1); - // Ensure our working directory matches the executable location so - // relative asset paths (assets/, FreeSans.ttf, etc.) resolve even - // when launching from a macOS .app bundle via Finder. - if (char* basePathRaw = SDL_GetBasePath()) { +#if defined(__APPLE__) + // On macOS bundles launched from Finder start in /, so re-root relative paths. + if (const char* basePathRaw = SDL_GetBasePath()) { std::filesystem::path exeDir(basePathRaw); - SDL_free(basePathRaw); + SDL_free(const_cast(basePathRaw)); std::error_code ec; std::filesystem::current_path(exeDir, ec); if (ec) { @@ -700,6 +699,7 @@ int main(int, char **) "SDL_GetBasePath() failed; asset lookups rely on current directory: %s", SDL_GetError()); } +#endif FontAtlas font; font.init("FreeSans.ttf", 24);