Bug 3570 – mkdirRecurse throws exception on trailing empty directory
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2009-12-03T16:51:00Z
Last change time
2015-06-09T01:27:04Z
Assigned to
rsinfu
Creator
Jesse.K.Phillips+D
Comments
Comment #0 by Jesse.K.Phillips+D — 2009-12-03T16:51:34Z
If the directory passed to mkdirRecurse ends with a backslash then an exception when the path provided ends with a backslash.
std.file.FileException: C:\fake\here\: Cannot create a file when that file already exists.
import std.file;
void main() {
auto dir = "C:\\fake\\here\\";
mkdirRecurse(dir);
}
The directories are correctly created. The code below works without throwing an exception.
import std.file;
void main() {
auto dir = "C:\\fake\\here";
mkdirRecurse(dir);
}