While we're at it, canonicalizing paths at creation time seems wrong also:

First because those two expressions do not return the same thing:
Path from: 'a/b/c/../d'
Path * / 'a' / 'b' / 'c' / '..' / 'd'

Second because if c happens to be a symlink, then the operating system will
not find the same thing as Pharo. The semantics is that you follow the
symlink first, and follow .. in the directory you end up in. So that goes
to the parent of the actual directory pointed to by the symlink, not back
one level in the path.

On 14 October 2016 at 13:59, Sven Van Caekenberghe <s...@stfx.eu> wrote:

> All this already works (although maybe not perfectly in edge cases).
> Consider:
>
>   'file:///C:/Users/tempfile.txt' asUrl.
>
>   'file:///C:/Users/tempfile.txt' asUrl asFileReference.
>
>   FileLocator C / 'Users' / 'tmpfile.txt'.
>
> Where the last two are identical.
>
> Note that relative file URLs do not exist.
>
> > On 14 Oct 2016, at 13:28, Gabriel Cotelli <g.cote...@gmail.com> wrote:
> >
> > At least Chrome uses this:
> >
> > file:///C:/Users/tempfile.txt
> >
> > On Fri, Oct 14, 2016 at 1:45 AM, Martin McClure <mar...@hand2mouse.com>
> wrote:
> > On 10/13/2016 10:35 AM, Damien Pollet wrote:
> > Could you give an example what the file:// URLs look like when they
> contain a drive letter?
> >
> > I'm afraid I don't have any Windows machines handy to see what Internet
> Explorer does, but as far as I can tell an absolute URL compliant with RFC
> 3986 might look something like
> >
> > file:/c:/foo/bar
> >
> > A relative URL that fits the URL syntax would be
> >
> > file:c:/foo/bar
> >
> > But I'm finding it difficult to tell precisely how RFCs 1738 and 3986
> currently interact.
> >
> > The discussion in this proposed RFC is somewhat interesting:
> https://tools.ietf.org/html/draft-ietf-appsawg-file-scheme-02, as it
> directly addresses Windows file naming. In appendix B.2, it says
> >
> > "When mapping a DOS- or Windows-like file path to a URI, use the drive
> >    letter (e.g. "c:") as the first path segment. Some implementations
> leave the leading slash off before the drive letter.  "
> >
> > and appendix C.1 deals with DOS file paths.
> >
> >
> > I hope this is more helpful than it is confusing.
> >
> > Regards,
> >
> > -Martin
> >
> >
> >
>
>
>


-- 
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet

Reply via email to