Add an asset path within the macOS app bundle

This commit is contained in:
RichardG867
2025-12-19 21:39:10 -03:00
parent 7c7ea31bc0
commit 0f2ce37949

View File

@@ -767,8 +767,10 @@ pc_init(int argc, char *argv[])
p = path_get_filename(exe_path);
*p = '\0';
#if defined(__APPLE__)
char contents_path[2048] = {0};
c = strlen(exe_path);
if ((c >= 16) && !strcmp(&exe_path[c - 16], "/Contents/MacOS/")) {
strncpy(contents_path, exe_path, c - 7);
exe_path[c - 16] = '\0';
p = path_get_filename(exe_path);
*p = '\0';
@@ -1035,10 +1037,18 @@ usage:
path_append_filename(temp, usr_path, "assets");
asset_add_path(temp);
// Add the standard ROM path in the same directory as the executable.
// Add the standard asset path in the same directory as the executable.
path_append_filename(temp, exe_path, "assets");
asset_add_path(temp);
#ifdef __APPLE__
// Add the standard asset path within the app bundle.
if (contents_path[0] != '\0') {
path_append_filename(temp, contents_path, "Resources/assets");
asset_add_path(temp);
}
#endif
plat_init_asset_paths();
/*