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 2339a0a commit 07188feCopy full SHA for 07188fe
src/libstd/fs.rs
@@ -1777,7 +1777,7 @@ impl DirBuilder {
1777
fn create_dir_all(&self, path: &Path) -> io::Result<()> {
1778
match self.inner.mkdir(path) {
1779
Ok(()) => return Ok(()),
1780
- 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(()),
1781
Err(ref e) if e.kind() == io::ErrorKind::NotFound => {}
1782
Err(e) => return Err(e),
1783
}
@@ -1787,7 +1787,7 @@ impl DirBuilder {
1787
1788
1789
Ok(()) => Ok(()),
1790
- Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists => Ok(()),
+ Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists && path.is_dir() => Ok(()),
1791
Err(e) => Err(e),
1792
1793
0 commit comments