[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: File URLs in NSURL
From: |
Richard Frith-Macdonald |
Subject: |
Re: File URLs in NSURL |
Date: |
Fri, 27 Jun 2003 07:16:40 +0100 |
On Thursday, June 26, 2003, at 05:14 pm, Fred Kiefer wrote:
absolute = [[NSURL fileURLWithPath: absolute] relativeString];
<snip>
But this does not give the correct result. According to the
specification the URL file name "absolute" should be something like
file:///home/fred/GNUstep/Images/TextSystem1.png
but in GNUStep I do get:
file:/home/fred/GNUstep/Images/TextSystem1.png
Yes ... that's because you asked for a 'relative' path ... so you get
the path component relative to the base location.
ie without the 'host' specification part. I think this is the correct
behavior - it conforms to the RFCs and is the same
as on MacOS-X
When using absoluteString instead of relativeString I get:
file://localhost/home/fred/GNUstep/Images/TextSystem1.png
There I agree ... IMO the RFCs imply that the hostname part of a file
scheme URL should be an empty string, which would give
file:///home/fred/GNUstep/Images/TextSystem1.png.
However, MacOS-X puts 'localhost' in the hostname position, so the
GNUstep code is written to be compatible with this.
Again this will result in a different MD5 digest than the one expected
by the thumbnail standard, so we wont find the correct file. The
question now is, if there is another method to get the required string
or if this is a bug in GNUstep, which we should correct.
I suggest using the -absoluteString method and removing the 'localhost'
While I think that the MacOS-X implementation is strange, it's the
definitive guide for this class (it's not in OpenStep), so I'de be very
hesitant to 'fix' this and break compatibility.