File URI (was RE: FileDirectory>>fileExists: (was: Re:[BUG]Unable to load BFAV, various problems ))

Frank Shearar frank.shearar at rnid.org.uk
Wed Apr 28 12:59:46 UTC 2004


> >>> "goran.krampe at bluefish.se" 04/28/04 14:45 >>>
>
> Michael Rueger <michael at squeakland.org> wrote:
> > goran.krampe at bluefish.se wrote:

<snip>

> > Let's not forget that you can have relative URIs like
> 'dir/file.txt'
> > that can be resolved against an absolute URI. You can
> resolve relative
> > paths against http, file or any other scheme.
>
> Yes, I agree. But the question is if this is an instance of FileUrl:
> 'dir/file.txt' ?
> I don't think so. IMHO a FileUrl has a hostname (or is
> localhost) and an
> absolute path.
>
> Then sure, you can resolve relative paths against it. But I
> still can't
> see that an instance of FileUrl can "be relative or absolute".

You could have a RelativeUrl class that has an absolute URL as a parent...

  'dir/file.txt' asRelativeUriTo: 'file://foo/bar/' asUrl.

which would represent the same URI as 'file://foo/bar/dir/file.txt' or

  'document' asRelativeUriTo: 'http://a.server/ asUrl

representing the same URI as 'http://a.server/document'.

The whole #isAbsolute thing boils down to Url>>isAbsolute returning true and
RelativeUrl>>isAbsolute overriding that with a "^false".

RelativeURL>>toText (which we still need to rename to asString) then says
something like

  ^self parent toText, '/', something-or-other.

frank





More information about the Squeak-dev mailing list