std.path.buildPath

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 3 07:23:30 PDT 2017


On 2017-06-03 16:12, Russel Winder via Digitalmars-d-learn wrote:
> From the manual page on std.path.buildPath:
>
>     writeln(buildPath("foo", "bar", "baz")); // "foo/bar/baz"
>     writeln(buildPath("/foo/", "bar/baz")); // "/foo/bar/baz"
>     writeln(buildPath("/foo", "/bar")); // "/bar"
>
> I have no idea what drugs the person who chose that last one to be
> correct semantics was on at the time, but it was some seriously bad
> stuff.
>
> "If any of the path segments are absolute (as defined by isAbsolute),
> the preceding segments will be dropped."
>
> I cannot find any excuse for this to be even remotely reasonable.

Unfortunately it's been like this since forever. I mean, I checked the 
git history, it's been like this for as long as we have history, 
including when it was called "join".

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list