buildPath() and absolute paths

Lars T. Kyllingstad public at kyllingen.net
Sun Jul 28 14:09:53 PDT 2013


Currently, std.path.buildPath() is designed so that if one of the path 
segments is rooted, then the preceding segments are simply dropped. 
That is,

    assert(buildPath("foo", "bar", "/baz") == "/baz");

The only reason I wrote it like this is that this was how the old (now 
deprecated and removed) join() function was designed, and buildPath() 
was supposed to be a drop-in replacement.

I have come to think this design sucks, and I want to fix it.  I cannot 
think of a single use case for it.  I have a new implementation of this 
function in the pipeline, so now seems like a good time.  Would anyone 
be opposed to me rewriting it so that it throws an exception when any 
path segment but the first is rooted?

Lars



More information about the Digitalmars-d mailing list