the full path of the directory to create
FileException on error.
import std.path : buildPath; auto dir = deleteme ~ "dir"; scope(exit) dir.rmdirRecurse; dir.mkdir; assert(dir.exists); dir.mkdirRecurse; // does nothing // creates all parent directories as needed auto nested = dir.buildPath("a", "b", "c"); nested.mkdirRecurse; assert(nested.exists);
import std.exception : assertThrown; scope(exit) deleteme.remove; deleteme.write("a"); // cannot make directory as it's already a file assertThrown!FileException(deleteme.mkdirRecurse);
Make directory and all parent directories as needed.
Does nothing if the directory specified by pathname already exists.