diff --git a/file_path_special.c b/file_path_special.c
index e51d8a95ae9..05b3bbda62c 100644
--- a/file_path_special.c
+++ b/file_path_special.c
@@ -102,30 +102,44 @@ bool fill_pathname_application_data(char *s, size_t len)
#endif
#elif defined(OSX)
-#if HAVE_STEAM
- CFStringRef parent_path;
- CFURLRef bundle_url, parent_url;
CFBundleRef bundle = CFBundleGetMainBundle();
+ bool portable = false;
if (!bundle)
return false;
- bundle_url = CFBundleCopyBundleURL(bundle);
- parent_url = CFURLCreateCopyDeletingLastPathComponent(NULL, bundle_url);
- parent_path = CFURLCopyFileSystemPath(parent_url, kCFURLPOSIXPathStyle);
- CFStringGetCString(parent_path, s, len, kCFStringEncodingUTF8);
- CFRelease(parent_path);
- CFRelease(parent_url);
- CFRelease(bundle_url);
- return true;
+#if HAVE_STEAM
+ portable = true;
#else
- const char *appdata = getenv("HOME");
-
- if (appdata)
+ CFStringRef key = CFStringCreateWithCString(NULL, "RAPortableInstall", kCFStringEncodingUTF8);
+ CFBooleanRef val = CFBundleGetValueForInfoDictionaryKey(bundle, key);
+ if (val)
+ portable = CFBooleanGetValue(val);
+ CFRelease(val);
+ CFRelease(key);
+#endif
+ if (portable)
{
- fill_pathname_join(s, appdata,
- "Library/Application Support/RetroArch", len);
- return true;
+ CFStringRef parent_path;
+ CFURLRef bundle_url, parent_url;
+ bundle_url = CFBundleCopyBundleURL(bundle);
+ parent_url = CFURLCreateCopyDeletingLastPathComponent(NULL, bundle_url);
+ parent_path = CFURLCopyFileSystemPath(parent_url, kCFURLPOSIXPathStyle);
+ CFStringGetCString(parent_path, s, len, kCFStringEncodingUTF8);
+ CFRelease(parent_path);
+ CFRelease(parent_url);
+ CFRelease(bundle_url);
+ return true;
+ }
+ else
+ {
+ const char *appdata = getenv("HOME");
+
+ if (appdata)
+ {
+ fill_pathname_join(s, appdata,
+ "Library/Application Support/RetroArch", len);
+ return true;
+ }
}
-#endif
#elif defined(RARCH_UNIX_CWD_ENV)
getcwd(s, len);
return true;
diff --git a/frontend/drivers/platform_darwin.m b/frontend/drivers/platform_darwin.m
index 795e21a4238..b49ea56843a 100644
--- a/frontend/drivers/platform_darwin.m
+++ b/frontend/drivers/platform_darwin.m
@@ -344,6 +344,7 @@ static void frontend_darwin_get_env(int *argc, char *argv[],
char documents_dir_buf[PATH_MAX_LENGTH] = {0};
char application_data[PATH_MAX_LENGTH] = {0};
CFBundleRef bundle = CFBundleGetMainBundle();
+ BOOL portable;
if (!bundle)
return;
@@ -356,23 +357,29 @@ static void frontend_darwin_get_env(int *argc, char *argv[],
#if HAVE_STEAM
/* For Steam, we're going to put everything next to the .app */
- fill_pathname_application_data(documents_dir_buf, sizeof(documents_dir_buf));
+ portable = YES;
#else
- CFSearchPathForDirectoriesInDomains(documents_dir_buf, sizeof(documents_dir_buf));
-#if TARGET_OS_IPHONE
- char resolved_documents_dir_buf[PATH_MAX_LENGTH] = {0};
- char resolved_bundle_dir_buf[PATH_MAX_LENGTH] = {0};
- if (realpath(documents_dir_buf, resolved_documents_dir_buf))
- strlcpy(documents_dir_buf,
- resolved_documents_dir_buf,
- sizeof(documents_dir_buf));
- if (realpath(bundle_path_buf, resolved_bundle_dir_buf))
- strlcpy(bundle_path_buf,
- resolved_bundle_dir_buf,
- sizeof(bundle_path_buf));
-#endif
- strlcat(documents_dir_buf, "/RetroArch", sizeof(documents_dir_buf));
+ portable = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"RAPortableInstall"] boolValue];
#endif
+ if (portable)
+ fill_pathname_application_data(documents_dir_buf, sizeof(documents_dir_buf));
+ else
+ {
+ CFSearchPathForDirectoriesInDomains(documents_dir_buf, sizeof(documents_dir_buf));
+#if TARGET_OS_IPHONE
+ char resolved_documents_dir_buf[PATH_MAX_LENGTH] = {0};
+ char resolved_bundle_dir_buf[PATH_MAX_LENGTH] = {0};
+ if (realpath(documents_dir_buf, resolved_documents_dir_buf))
+ strlcpy(documents_dir_buf,
+ resolved_documents_dir_buf,
+ sizeof(documents_dir_buf));
+ if (realpath(bundle_path_buf, resolved_bundle_dir_buf))
+ strlcpy(bundle_path_buf,
+ resolved_bundle_dir_buf,
+ sizeof(bundle_path_buf));
+#endif
+ strlcat(documents_dir_buf, "/RetroArch", sizeof(documents_dir_buf));
+ }
#if defined(OSX)
fill_pathname_application_data(application_data, sizeof(application_data));
diff --git a/pkg/apple/OSX/Info_Metal.plist b/pkg/apple/OSX/Info_Metal.plist
index ebd73fd076a..3dabdb556a7 100644
--- a/pkg/apple/OSX/Info_Metal.plist
+++ b/pkg/apple/OSX/Info_Metal.plist
@@ -51,5 +51,7 @@
MainMenu_Metal
NSPrincipalClass
NSApplication
+ RAPortableInstall
+