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);