From 3c6466e2a0fa2bdd07fc6e46b5c4d88d68364d9f Mon Sep 17 00:00:00 2001 From: Gregor Klevze Date: Wed, 10 Dec 2025 19:38:06 +0100 Subject: [PATCH] fix mac resources --- src/utils/ImagePathResolver.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/utils/ImagePathResolver.h b/src/utils/ImagePathResolver.h index 90c1f7f..75f72e8 100644 --- a/src/utils/ImagePathResolver.h +++ b/src/utils/ImagePathResolver.h @@ -70,6 +70,22 @@ inline std::string resolveWithBase(const std::string& path) { if (tryOpenFile(combinedStr)) { return combinedStr; } + +#if defined(__APPLE__) + // When running from a macOS bundle, SDL_GetBasePath may point at + // Contents/Resources while assets are in Contents/MacOS. Search that + // sibling too so Finder launches find the packaged assets. + std::filesystem::path basePath(base); + auto contentsDir = basePath.parent_path(); + if (contentsDir.filename() == "Resources") { + auto macosDir = contentsDir.parent_path() / "MacOS"; + std::filesystem::path alt = macosDir / p; + std::string altStr = alt.string(); + if (tryOpenFile(altStr)) { + return altStr; + } + } +#endif } } return path;