buildPath() and absolute paths

Jonathan M Davis jmdavisProg at gmx.com
Sun Jul 28 14:22:31 PDT 2013


On Sunday, July 28, 2013 23:09:53 Lars T. Kyllingstad wrote:
> 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?

Well, it would potentially break code, but it would as far as I can tell, it 
would only break code which is buggy. So, I don't see a problem with it.

- Jonathan M Davis


More information about the Digitalmars-d mailing list