mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +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
a312d7cec7
commit
37a80c5e5a
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>
|
2002-08-24 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSURL.m: Hacks for compatibility with MacOS-X in returning
|
* 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.
|
path of a file URL ... the RFC says we should only return a path
|
||||||
Also when creating relative file URLs the MacOS-X code doesn't
|
for a generic URL (scheme://user:passwd@host:port/path#frag?query)
|
||||||
strip the last patch component of the base URL as it should ...
|
which a file URL certainly isn't. However, for compatibility we
|
||||||
we emulate that too.
|
now treat a file URL more like a generic one.
|
||||||
Final note ... the MacOS-X code inserts 'localhost' as a host name
|
Also when creating absolute file URLs from base plus relative,
|
||||||
for a file URL which it shouldnt (a file URL has no host part) but
|
the MacOS-X code doesn't strip the last path component of the
|
||||||
we don't emulate that at present (perhaps never as I can't see it
|
base URL as it should ... we emulate that too.
|
||||||
being very useful).
|
|
||||||
|
|
||||||
2002-08-22 Richard Frith-Macdonald <rfm@gnu.org>
|
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->user == 0 && buf->password == 0
|
||||||
&& buf->host == 0 && buf->port == 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 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)
|
unsigned int len = (_baseURL ? strlen(baseData->path) : 0)
|
||||||
+ strlen(myData->path) + 3;
|
+ strlen(myData->path) + 3;
|
||||||
|
|
|
@ -9,7 +9,7 @@ static void test1(void)
|
||||||
NSURL *baseURL = [NSURL fileURLWithPath:@"/usr/local/bin"];
|
NSURL *baseURL = [NSURL fileURLWithPath:@"/usr/local/bin"];
|
||||||
NSURL *url = [NSURL URLWithString:@"filename" relativeToURL:baseURL];
|
NSURL *url = [NSURL URLWithString:@"filename" relativeToURL:baseURL];
|
||||||
NSString *result = [url absoluteString];
|
NSString *result = [url absoluteString];
|
||||||
NSString *expected = @"file:/usr/local/bin/filename";
|
NSString *expected = @"file://localhost/usr/local/bin/filename";
|
||||||
|
|
||||||
if ([result isEqualToString:expected])
|
if ([result isEqualToString:expected])
|
||||||
NSLog(@"test 1 ok");
|
NSLog(@"test 1 ok");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue