Skip to content

Commit 0b1fb1d

Browse files
committed
CoreFoundation: Correctly construct user preferences directory
1 parent 59a8004 commit 0b1fb1d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/CoreFoundation/CFKnownLocations.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ CFURLRef _Nullable _CFKnownLocationCreatePreferencesURLForUser(CFKnownLocationUs
4343
// passthrough to:
4444
case _kCFKnownLocationUserByName: {
4545
CFURLRef home = CFCopyHomeDirectoryURLForUser(username);
46-
location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("/Library/Preferences"), kCFURLPOSIXPathStyle, true, home);
46+
location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("Library/Preferences"), kCFURLPOSIXPathStyle, true, home);
4747
CFRelease(home);
4848

4949
break;
@@ -133,16 +133,16 @@ CFURLRef _Nullable _CFKnownLocationCreatePreferencesURLForUser(CFKnownLocationUs
133133
CFURLRef userdir = CFCopyHomeDirectoryURL();
134134
switch (user) {
135135
case _kCFKnownLocationUserAny:
136-
location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("/Apple/Library/Preferences/AnyUser"), kCFURLPOSIXPathStyle, true, userdir);
136+
location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("Apple/Library/Preferences/AnyUser"), kCFURLPOSIXPathStyle, true, userdir);
137137
break;
138138
case _kCFKnownLocationUserByName: {
139-
CFURLRef tmp = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("/Apple/Library/Preferences/ByUser"), kCFURLPOSIXPathStyle, true, userdir);
139+
CFURLRef tmp = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("Apple/Library/Preferences/ByUser"), kCFURLPOSIXPathStyle, true, userdir);
140140
location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, username, kCFURLPOSIXPathStyle, true, tmp);
141141
CFRelease(tmp);
142142
break;
143143
}
144144
case _kCFKnownLocationUserCurrent:
145-
location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("/Apple/Library/Preferences"), kCFURLPOSIXPathStyle, true, userdir);
145+
location = CFURLCreateWithFileSystemPathRelativeToBase(kCFAllocatorSystemDefault, CFSTR("Apple/Library/Preferences"), kCFURLPOSIXPathStyle, true, userdir);
146146
break;
147147
}
148148
CFRelease(userdir);

0 commit comments

Comments
 (0)