Bug 5759 – std.path.join incorrectly joins directories

Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-03-20T10:15:00Z
Last change time
2011-03-20T17:34:02Z
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2011-03-20T10:15:24Z
import std.file; import std.path; string subdir; static this() { subdir = join(curdir, r"\subdir\"); } void main() { assert(subdir == r"\subdir\"); // this is incorrect if (!exists(subdir)) { mkdirRecurse(subdir); // creates "C:\subdir\" } subdir = r".\subdir\"; // correct version if (!exists(subdir)) { mkdirRecurse(subdir); // creates a subdirectory "subdir" in the current directory } }
Comment #1 by andrej.mitrovich — 2011-03-20T10:16:24Z
Note: this was tested on Windows. I don't know if the behavior is the same on Linux.
Comment #2 by andrej.mitrovich — 2011-03-20T17:34:02Z
std.path is probably being replaced, and apparently doesn't suffer from this problem. I'm closing it down.