From 53157fa22cf0a3f7379082940db910d9dc10c622 Mon Sep 17 00:00:00 2001 From: rfm Date: Fri, 7 Jan 2011 10:19:51 +0000 Subject: [PATCH] Fix to get NSURL -resourceSpecifier regression tests to pass again. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31849 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 2 ++ Source/NSURL.m | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 589ccf91c..773efd3ab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2011-01-07 Richard Frith-Macdonald * Source/NSObject.m: Make zombie log message match current OSX. + * Source/NSURL.m: Fix -resourceSpecifier by removing incorrect + special handling for file URLs. 2011-01-06 Fred Kiefer diff --git a/Source/NSURL.m b/Source/NSURL.m index 5351eaec7..df4f1031e 100644 --- a/Source/NSURL.m +++ b/Source/NSURL.m @@ -1770,12 +1770,19 @@ static unsigned urlAlign; if (range.length > 0) { NSString *specifier; - /* MacOSX compatibility - file schemes just return the path (without - the "//") but everything else returns the whole specifier */ - if ([[self scheme] isEqual: @"file"]) - specifier = [_urlString substringFromIndex: NSMaxRange(range)]; + + /* MacOSX compatibility - in the case where there is no + * host in the URL, just return the path (without the "//"). + * For all other cases we return the whole specifier. + */ + if (nil == [self host]) + { + specifier = [_urlString substringFromIndex: NSMaxRange(range)]; + } else - specifier = [_urlString substringFromIndex: range.location+1]; + { + specifier = [_urlString substringFromIndex: range.location+1]; + } return specifier; } else