Fix new version of `create_dir_all`
It will now correctly fail on existing non-directories.
This commit is contained in:
parent
db00ba9eb2
commit
0ec28b796d
|
@ -1777,7 +1777,7 @@ impl DirBuilder {
|
|||
fn create_dir_all(&self, path: &Path) -> io::Result<()> {
|
||||
match self.inner.mkdir(path) {
|
||||
Ok(()) => return Ok(()),
|
||||
Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists => return Ok(()),
|
||||
Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists && path.is_dir() => return Ok(()),
|
||||
Err(ref e) if e.kind() == io::ErrorKind::NotFound => {}
|
||||
Err(e) => return Err(e),
|
||||
}
|
||||
|
@ -1787,7 +1787,7 @@ impl DirBuilder {
|
|||
}
|
||||
match self.inner.mkdir(path) {
|
||||
Ok(()) => Ok(()),
|
||||
Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists => Ok(()),
|
||||
Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists && path.is_dir() => Ok(()),
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue