[phobos] RFC: std.path

Lars Tandle Kyllingstad lars at kyllingen.net
Sun Jun 12 08:59:59 PDT 2011


On Sun, 2011-06-12 at 12:41 -0300, Jose Armando Garcia wrote:
> On Sun, Jun 12, 2011 at 12:15 PM, Lars Tandle Kyllingstad
> <lars at kyllingen.net> wrote:
> > On Sun, 2011-06-12 at 11:39 -0300, Jose Armando Garcia wrote:
> >> On Wed, Jun 8, 2011 at 4:29 PM, Lars Tandle Kyllingstad
> > These functions are from the old std.path, and I haven't made any
> > changes to them in my version.
> >
> > - toAbsolute()
> > - toCanonical()
> >
> 
> In the comments where you say that it doesn't perform any IO you
> should add these functions.

Does getcwd() perform any IO on Windows?  AFAIK, on POSIX it just
queries /proc/self/cwd, which is a virtual file.


> Speaking of which can we add a template
> called normalize (maybe you can come up with a better name) that does
> what canonical does but doesn't make it absolute. E.g.:
> 
> version(windows) assert(normilize("dir/file") == "dir\\file");
> version(windows) assert(normilize("dir/./file") == "dir\\file");
> //etc

That sounds like a good idea.  Then I guess normalize("../foo") should
just return "..\\foo", i.e. leave the ".." unresolved?

-Lars



More information about the phobos mailing list