fix mac resources
This commit is contained in:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user