aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMNSObject+KeyValueObserving.m
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2012-02-21 18:30:13 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2012-02-21 18:30:13 +0000
commit8d29af68e02e7ebf54014dc79ecb47a52e56fc96 (patch)
tree0dcfc1de612a225d4a8569d4d1db3b11c5abd80d /Foundation/GTMNSObject+KeyValueObserving.m
parentdb66b39810ab292ee3914f31a4b961c3bdddd02c (diff)
[Author: thomasvl]
Add check for iOS and Xcode 4 behaviors that makes everything appears to be a system path by old check. R=dmaclach DELTA=7 (5 added, 0 deleted, 2 changed)
Diffstat (limited to 'Foundation/GTMNSObject+KeyValueObserving.m')
-rw-r--r--Foundation/GTMNSObject+KeyValueObserving.m9
1 files changed, 7 insertions, 2 deletions
diff --git a/Foundation/GTMNSObject+KeyValueObserving.m b/Foundation/GTMNSObject+KeyValueObserving.m
index fa07fab..8d6580d 100644
--- a/Foundation/GTMNSObject+KeyValueObserving.m
+++ b/Foundation/GTMNSObject+KeyValueObserving.m
@@ -667,13 +667,18 @@ GTM_METHOD_CHECK(NSObject,
+ (BOOL)_gtmAccessInstanceVariablesDirectly {
// Apple has lots of "bad" direct instance variable accesses, so we
- // only want to check our code, as opposed to library code.
+ // only want to check our code, as opposed to library code. iOS simulator
+ // builds copy the app into the user's home directory. Xcode 4 also changes
+ // the default location of the output directory. Don't count being within
+ // the user's home and under "/Library/" as being a system library.
// If this turns out to be slow, we may want to consider a cache to speed
// things up.
NSBundle *bundle = [NSBundle bundleForClass:self];
NSString *path = [bundle bundlePath];
- return [path rangeOfString:@"/Library/"].location != NSNotFound;
+ BOOL hasLibrary = [path rangeOfString:@"/Library/"].location != NSNotFound;
+ BOOL startsWithUser = [path hasPrefix:@"/Users/"];
+ return !startsWithUser && hasLibrary;
}
#endif // GTM_PERFORM_KVO_CHECKS