Skip to content

Commit 0a92cbd

Browse files
asder8215tbu-
andauthored
check if error is AlreadyExists before checking if the directory was created
Co-authored-by: Tobias Bucher <[email protected]>
1 parent 2425244 commit 0a92cbd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/std/src/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3358,7 +3358,7 @@ impl DirBuilder {
33583358
uncreated_dirs.extend(ancestors.take(uncreated_dir_ctr));
33593359

33603360
for uncreated_dir in uncreated_dirs.iter().rev() {
3361-
if let Err(e) = self.inner.mkdir(uncreated_dir) {
3361+
if e.kind() != io::ErrorKind::AlreadyExists || !uncreated_dir.is_dir() {
33623362
if !uncreated_dir.is_dir() {
33633363
return Err(e);
33643364
}

0 commit comments

Comments
 (0)