[Q] Isn't 'file://foo/bar' asUrl supposed to give a relative
FileUrl?
Bert Freudenberg
bert at isg.cs.uni-magdeburg.de
Wed Aug 6 13:37:37 UTC 2003
Markus Gaelli wrote:
> The situation right now is as follows:
>
> 'file:foo/bar' asUrl isAbsolute -> false
> 'file:/foo/bar' asUrl isAbsolute -> true
Both of these are not valid file urls. But see below.
> 'file://foo/bar' asUrl isAbsolute -> true
> 'file:///foo/bar' asUrl isAbsolute -> true
>
> According to http://www.w3.org/Addressing/rfc1738.txt and
> http://www.cs.tut.fi/~jkorpela/fileurl.html
> there always should be two leading /, after the name of the
> protocol. So we allow the first two lines above only for convenience.
Right.
> But how could one create a local url (in the case of Squeak
> local to the current squeak dir, I guess) legally?
You mean a "relative url"? There is no such thing.
> Right now you can't.
Why not? Suppose your base document is 'file:///home/markus/squeak/foo',
then a relative reference to access 'file:///home/markus/squeak/bar'
would be 'bar'.
"Relative urls" only make sense with respect to some base document. You
take the url of the base document, strip anything past the last slash,
and append your relative path. A "relative" url is signified by the
absence of the scheme part, and possibly the host part and path part.
> So I would suggest, that 'file://foo/bar' asUrl pathForFile
> should give us a _local_ file, and that
> 'file://foo/bar' asUrl isAbsolute" should yield false.
Nonsense. 'file://foo/bar' refers to file '/bar' on host 'foo'.
We could define "FileDirectory default" to be the base URL for all
Squeak content. You then could access stuff with just 'foo/bar/baz'
which would be relative to the Squeak default directory. We'd just have
to write this convention down somewhere.
As an extension, we can treat 'file:foo/bar/baz' the same by just
stripping the 'file:' part. And we can convert 'file:/foo/bar/baz' into
the correct 'file:///foo/bar/baz'. These "convenience" urls seem useful
to me. Now this is exactly what Squeak currently does, right? I did not
check, but it should.
-- Bert
More information about the Squeak-dev
mailing list
|