We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
create_dir_all("")
1 parent bcae6a3 commit b5d590bCopy full SHA for b5d590b
src/libstd/fs.rs
@@ -1775,6 +1775,10 @@ impl DirBuilder {
1775
}
1776
1777
fn create_dir_all(&self, path: &Path) -> io::Result<()> {
1778
+ if path == Path::new("") {
1779
+ return Ok(())
1780
+ }
1781
+
1782
match self.inner.mkdir(path) {
1783
Ok(()) => return Ok(()),
1784
Err(ref e) if e.kind() == io::ErrorKind::NotFound => {}
@@ -2302,6 +2306,16 @@ mod tests {
2302
2306
check!(fs::create_dir_all(&Path::new("/")));
2303
2307
2304
2308
2309
+ #[test]
2310
+ fn recursive_mkdir_dot() {
2311
+ check!(fs::create_dir_all(&Path::new(".")));
2312
2313
2314
2315
+ fn recursive_mkdir_empty() {
2316
+ check!(fs::create_dir_all(&Path::new("")));
2317
2318
2305
2319
#[test]
2320
fn recursive_rmdir() {
2321
let tmpdir = tmpdir();
0 commit comments