Skip to content
Browse files

Fixes 253929

Fixed a workaround for using registered user defaults on Tiger that I managed to break. Go me!
  • Loading branch information...
1 parent 5684a14 commit 7228235ce3944003a052d30ff9819e9e2e482110 @andymatuschak andymatuschak committed Aug 3, 2008
Showing with 5 additions and 5 deletions.
  1. +5 −5 SUHost.m
View
10 SUHost.m
@@ -121,13 +121,13 @@ - (BOOL)boolForInfoDictionaryKey:(NSString *)key
- (id)objectForUserDefaultsKey:(NSString *)defaultName
{
- CFPropertyListRef obj = CFPreferencesCopyAppValue((CFStringRef)defaultName, (CFStringRef)[bundle bundleIdentifier]);
// Under Tiger, CFPreferencesCopyAppValue doesn't get values from NSRegistratioDomain, so anything
// passed into -[NSUserDefaults registerDefaults:] is ignored. The following line falls
- // back to using NSUserDefaults, but only if the host bundle is the main bundle, and no value
- // is found elsewhere.
- if (obj == NULL && bundle != [NSBundle mainBundle])
- obj = [[NSUserDefaults standardUserDefaults] objectForKey:defaultName];
+ // back to using NSUserDefaults, but only if the host bundle is the main bundle.
+ if (bundle == [NSBundle mainBundle])
+ return [[NSUserDefaults standardUserDefaults] objectForKey:defaultName];
+
+ CFPropertyListRef obj = CFPreferencesCopyAppValue((CFStringRef)defaultName, (CFStringRef)[bundle bundleIdentifier]);
#if MAC_OS_X_VERSION_MIN_REQUIRED > 1050
return [NSMakeCollectable(obj) autorelease];
#else

0 comments on commit 7228235

Please sign in to comment.
Something went wrong with that request. Please try again.