From 9698f8937ccf80a35f678c72e773f3c315cb9d18 Mon Sep 17 00:00:00 2001 From: Marco Rebhan Date: Tue, 4 Mar 2025 04:37:59 +0100 Subject: [PATCH] CoreFoundation: Correctly construct user preferences directory --- Sources/CoreFoundation/CFKnownLocations.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/CoreFoundation/CFKnownLocations.c b/Sources/CoreFoundation/CFKnownLocations.c index 4ed726b891..23c60712c6 100644 --- a/Sources/CoreFoundation/CFKnownLocations.c +++ b/Sources/CoreFoundation/CFKnownLocations.c @@ -43,7 +43,7 @@ CFURLRef _Nullable _CFKnownLocationCreatePreferencesURLForUser(CFKnownLocationUs // passthrough to: case _kCFKnownLocationUserByName: { CFURLRef home = CFCopyHomeDirectoryURLForUser(username); - location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("/Library/Preferences"), kCFURLPOSIXPathStyle, true, home); + location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("Library/Preferences"), kCFURLPOSIXPathStyle, true, home); CFRelease(home); break; @@ -133,16 +133,16 @@ CFURLRef _Nullable _CFKnownLocationCreatePreferencesURLForUser(CFKnownLocationUs CFURLRef userdir = CFCopyHomeDirectoryURL(); switch (user) { case _kCFKnownLocationUserAny: - location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("/Apple/Library/Preferences/AnyUser"), kCFURLPOSIXPathStyle, true, userdir); + location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("Apple/Library/Preferences/AnyUser"), kCFURLPOSIXPathStyle, true, userdir); break; case _kCFKnownLocationUserByName: { - CFURLRef tmp = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("/Apple/Library/Preferences/ByUser"), kCFURLPOSIXPathStyle, true, userdir); + CFURLRef tmp = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("Apple/Library/Preferences/ByUser"), kCFURLPOSIXPathStyle, true, userdir); location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, username, kCFURLPOSIXPathStyle, true, tmp); CFRelease(tmp); break; } case _kCFKnownLocationUserCurrent: - location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("/Apple/Library/Preferences"), kCFURLPOSIXPathStyle, true, userdir); + location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("Apple/Library/Preferences"), kCFURLPOSIXPathStyle, true, userdir); break; } CFRelease(userdir);