std.path.buildPath

Jesse Phillips via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 3 22:44:39 PDT 2017


On Saturday, 3 June 2017 at 14:12:03 UTC, Russel Winder 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.

What is your expected behavior? Throw an exception? You can't 
really append an absolute path to another.


More information about the Digitalmars-d-learn mailing list