Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1312,11 +1312,20 @@ impl DirBuilder {
}

fn create_dir_all(&self, path: &Path) -> io::Result<()> {
use io::{ErrorKind};
if path == Path::new("") || path.is_dir() { return Ok(()) }
if let Some(p) = path.parent() {
try!(self.create_dir_all(p))
}
self.inner.mkdir(path)
match self.inner.mkdir(path) {
Err(ref e) if e.kind() == ErrorKind::AlreadyExists
&& path.is_dir() => {
// It looks like the directory was created after
// we checked, so this is not an error after all.
Ok(())
},
r => r,
}
}
}

Expand Down