digitalmars.D.bugs - [Issue 17490] New: std.path.buildPath on Windows returns incorrect
- via Digitalmars-d-bugs (32/35) Jun 11 2017 https://issues.dlang.org/show_bug.cgi?id=17490
https://issues.dlang.org/show_bug.cgi?id=17490 Issue ID: 17490 Summary: std.path.buildPath on Windows returns incorrect paths Product: D Version: D2 Hardware: All OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: dlang ryanjframe.com std.path.buildPath should convert its input to the correct path representation (e.g., replace slashes with backslashes). Most of the time, Windows can use the forward slash, but Phobos should always return paths with backslashes because: - a couple of weird things can happen with some API functions [0]. - backslashes are required for extended-length paths (prepended with "\\?\") [1]. - consistency; if I'm going to print a path to the user, it needs to be what they'll expect, and I shouldn't have to modify what the standard library returns. Note that Windows does call "\foo" an absolute path (it implicitly prepends the current drive).writeln(buildPath("c:\\asdf", "/bcd")); // "c:/bcd"; want "c:\bcd" writeln(buildPath("c:\\asdf/", "bcd")); // "c:\asdf/bcd"; want "c:\asdf\bcd" writeln(buildPath("c:/asdf", "d:/bcd")); // "d:/bcd"; want "d:\bcd"[0] LoadLibrary: https://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx?f=255&MSPPError=-2147217396 "When specifying a path, be sure to use backslashes (\), not forward slashes (/)." [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#paths --
Jun 11 2017