Ian Lynagh | 9 Dec 18:04
Picon
Gravatar

Re: filepath

On Sun, Dec 09, 2007 at 03:57:17PM +0000, Duncan Coutts wrote:
> 
> On Sun, 2007-12-09 at 13:34 +0000, Ian Lynagh wrote:
> > 
> > The first is this:
> >     Prelude System.FilePath> "." </> "foo"
> >     "./foo"
> > which means we get things like
> >     [2 of 2] Compiling GHC.Foo          ( ./GHC/Foo.hs, ./GHC/Foo.o )
> > rather than
> >     [2 of 2] Compiling GHC.Foo          ( GHC/Foo.hs, GHC/Foo.o )
> > Is there a reason the result shouldn't be "foo"?
> 
> The function that does that is normalise. It strips leading . and
> colapses things like foo/../

If I start off with filepaths in normal form then I don't think I should
need to normalise the result after using a function like </>, though.

> > Possibly relatedly, the current directory seems to be "" rather than
> > ".". This turns up in at least a couple of areas:
> >     Prelude System.FilePath> normalise "."
> >     ""
>
> That's just a bug.

The "Possibly relatedly" is because currently filepath doesn't think
that "." is in normal form (which breaks my argument above), but IMO it
should be.

Thanks
Ian

Gmane