Path as an object in std.path

Walter Bright newshound2 at digitalmars.com
Thu Jun 6 10:50:13 PDT 2013


On 6/6/2013 9:14 AM, Dylan Knutson wrote:
> It doesn't do any allocations that the user won't have to do anyways. Paths have
> to be normalized before comparison; not doing so isn't correct behavior. Eg, the
> strings `foo../bar` != `bar`, yet they're equivalent paths. Path encapsulates
> the behavior. So it's the difference between
>
> buildNormalizedPath(s1) == buildNormalizedPath(s2);
>
> and
>
> p1 == p2;

I believe it is a mistake to try and automatically hide the difference between 
./bar and bar. Paths being == and 'referring to the same file' are different things.

For example, what about symlinks?

For performance reasons, also, I'd want to normalize sometime after building the 
entire path, I wouldn't want to normalize at each step. Normalization should be 
an explicit step, not implicit.


More information about the Digitalmars-d mailing list