mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
mproved MacOS-X compatibility.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14323 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
86b2121e5d
commit
c3fd0e813f
3 changed files with 18 additions and 11 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,14 +1,13 @@
|
|||
2002-08-24 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSURL.m: Hacks for compatibility with MacOS-X in returning
|
||||
path of a file URL ... the RFC says we shouldn't, but MacOS-X does.
|
||||
Also when creating relative file URLs the MacOS-X code doesn't
|
||||
strip the last patch component of the base URL as it should ...
|
||||
we emulate that too.
|
||||
Final note ... the MacOS-X code inserts 'localhost' as a host name
|
||||
for a file URL which it shouldnt (a file URL has no host part) but
|
||||
we don't emulate that at present (perhaps never as I can't see it
|
||||
being very useful).
|
||||
path of a file URL ... the RFC says we should only return a path
|
||||
for a generic URL (scheme://user:passwd@host:port/path#frag?query)
|
||||
which a file URL certainly isn't. However, for compatibility we
|
||||
now treat a file URL more like a generic one.
|
||||
Also when creating absolute file URLs from base plus relative,
|
||||
the MacOS-X code doesn't strip the last path component of the
|
||||
base URL as it should ... we emulate that too.
|
||||
|
||||
2002-08-22 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -894,7 +894,15 @@ static void unescape(const char *from, char * to)
|
|||
}
|
||||
}
|
||||
|
||||
if (base != 0
|
||||
if (buf->isFile == YES)
|
||||
{
|
||||
buf->user = 0;
|
||||
buf->password = 0;
|
||||
buf->host = "localhost";
|
||||
buf->port = 0;
|
||||
buf->isGeneric = YES;
|
||||
}
|
||||
else if (base != 0
|
||||
&& buf->user == 0 && buf->password == 0
|
||||
&& buf->host == 0 && buf->port == 0)
|
||||
{
|
||||
|
@ -1203,7 +1211,7 @@ static void unescape(const char *from, char * to)
|
|||
/*
|
||||
* If this scheme is from a URL without generic format, there is no path.
|
||||
*/
|
||||
if (myData->isGeneric == YES || myData->isFile == YES)
|
||||
if (myData->isGeneric == YES)
|
||||
{
|
||||
unsigned int len = (_baseURL ? strlen(baseData->path) : 0)
|
||||
+ strlen(myData->path) + 3;
|
||||
|
|
|
@ -9,7 +9,7 @@ static void test1(void)
|
|||
NSURL *baseURL = [NSURL fileURLWithPath:@"/usr/local/bin"];
|
||||
NSURL *url = [NSURL URLWithString:@"filename" relativeToURL:baseURL];
|
||||
NSString *result = [url absoluteString];
|
||||
NSString *expected = @"file:/usr/local/bin/filename";
|
||||
NSString *expected = @"file://localhost/usr/local/bin/filename";
|
||||
|
||||
if ([result isEqualToString:expected])
|
||||
NSLog(@"test 1 ok");
|
||||
|
|
Loading…
Reference in a new issue