diff --git a/ChangeLog b/ChangeLog index d59cea62f..83f4411cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ * Source/NSAffineTransform.m: Fix decoding of keyed archive containing identity transform. + * Source/NSString.m: + * Tests/base/NSString/tilde.m: + Fix to standardize string if necessary to determine whether it has + the home directory as a prefix. 2013-03-23 Fred Kiefer diff --git a/Source/NSString.m b/Source/NSString.m index 6a6a7f8b0..1bad340ea 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -4209,10 +4209,21 @@ static NSFileManager *fm = nil; { NSString *homedir = NSHomeDirectory (); - if (![self hasPrefix: homedir]) + if (YES == [self hasPrefix: @"~"]) { return IMMUTABLE(self); } + if (NO == [self hasPrefix: homedir]) + { + /* OSX compatibility ... we clean up the path to try to get a + * home directory we can abbreviate. + */ + self = [self stringByStandardizingPath]; + if (NO == [self hasPrefix: homedir]) + { + return IMMUTABLE(self); + } + } if ([self length] == [homedir length]) { return @"~";