Skip to content

Commit 80dbe1d

Browse files
Anton Pogonetslxbndr
authored andcommitted
Add CF_MAIN_BUNDLE_PATH for android
1 parent 6db803e commit 80dbe1d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CoreFoundation/PlugIn.subproj/CFBundle_Main.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,19 @@ static CFBundleRef _CFBundleGetMainBundleAlreadyLocked(void) {
8080
CFStringRef str = NULL;
8181
CFURLRef executableURL = NULL, bundleURL = NULL;
8282
_initedMainBundle = true;
83+
84+
#if defined(__ANDROID__)
85+
const char *bundlePath = getenv("CF_MAIN_BUNDLE_PATH");
86+
if (bundlePath) {
87+
str = CFStringCreateWithFileSystemRepresentation(kCFAllocatorSystemDefault, bundlePath);
88+
bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorSystemDefault, str, PLATFORM_PATH_STYLE, true);
89+
processPath = NULL;
90+
} else {
91+
processPath = _CFProcessPath();
92+
}
93+
#else
8394
processPath = _CFProcessPath();
95+
#endif
8496
if (processPath) {
8597
str = CFStringCreateWithFileSystemRepresentation(kCFAllocatorSystemDefault, processPath);
8698
if (!executableURL) executableURL = CFURLCreateWithFileSystemPath(kCFAllocatorSystemDefault, str, PLATFORM_PATH_STYLE, false);

0 commit comments

Comments
 (0)