Skip to content

Commit a7c5afa

Browse files
committed
Base: stub KnownLocations for android
Add a path through KnownLocations for android. This currently cannot be computed as we do not have the activity context nor do we know if the activity was spawned from the zygote or was a NDK process so we do not have a reference to Davlik to JNI and query the required information. This is sufficient to get the SDK building for android though.
1 parent f2c4df9 commit a7c5afa

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

CoreFoundation/Base.subproj/CFKnownLocations.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,21 @@ CFURLRef _Nullable _CFKnownLocationCreatePreferencesURLForUser(CFKnownLocationUs
9191
break;
9292
}
9393

94+
#elif TARGET_OS_ANDROID
95+
96+
switch (user) {
97+
case _kCFKnownLocationUserAny:
98+
case _kCFKnownLocationUserByName:
99+
abort();
100+
case _kCFKnownLocationUserCurrent: {
101+
const char *buffer = getenv("CFFIXED_USER_HOME");
102+
CFURLRef userdir = CFURLCreateFromFileSystemRepresentation(kCFAllocatorSystemDefault, (const unsigned char *)buffer, strlen(buffer), true);
103+
location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("/Apple/Library/Preferences"), kCFURLPOSIXPathStyle, true, userdir);
104+
CFRelease(userdir);
105+
break;
106+
}
107+
}
108+
94109
#else
95110

96111
#error For this platform, you need to define a preferences path for both 'any user' (i.e. installation-wide preferences) or the current user.

0 commit comments

Comments
 (0)