Skip to content

Commit d877f27

Browse files
committed
Base: implement KnownLocations for android
Add support for android to KnownLocations. Assume that only current user is supported as all applications in android are isolated and single user. For now, place all files in ~/Apple/Library/Preferences. This is the last piece needed in CoreFoundation for Android support.
1 parent e3fe2b5 commit d877f27

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

CoreFoundation/Base.subproj/CFKnownLocations.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,20 @@ 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+
CFURLRef home = CFCopyHomeDirectoryURLForUser(CFGetUserName());
102+
location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("/Apple/Library/Preferences"), kCFURLPOSIXPathStyle, true, home);
103+
CFRelease(home);
104+
break;
105+
}
106+
}
107+
94108
#else
95109

96110
#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)