diff options
| author | Dawid Ciężarkiewicz <dpc@dpc.pw> | 2017-03-14 22:29:00 -0700 |
|---|---|---|
| committer | Dawid Ciężarkiewicz <dpc@dpc.pw> | 2017-03-17 20:15:05 -0700 |
| commit | c3e2eaf4cb774f776f4022406742f978580c0a53 (patch) | |
| tree | e0e6defadcde83d4c9c3039e8fdead3be6677597 /src/libstd | |
| parent | a51c6aaf848a6cd64ace890effb6e377bbefce7d (diff) | |
| download | rust-c3e2eaf4cb774f776f4022406742f978580c0a53.tar.gz rust-c3e2eaf4cb774f776f4022406742f978580c0a53.zip | |
Fix problems found on Windows in `dir_create_all`
Ignore the type of error altogether. The rationale is: it doesn't matter what was the problem if the directory is there. In the previous versions if the directory was there already we wouldn't even attempt to create it, so we wouldn't know about the problem neither. Make test path length smaller in `concurrent_recursive_mkdir` test.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/fs.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index e26b84d6b07..91cf0d44d9d 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -1777,8 +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 && path.is_dir() => return Ok(()), + Err(_) if path.is_dir() => return Ok(()), Err(ref e) if e.kind() == io::ErrorKind::NotFound => {} Err(e) => return Err(e), } @@ -1788,7 +1787,7 @@ impl DirBuilder { } match self.inner.mkdir(path) { Ok(()) => Ok(()), - Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists && path.is_dir() => Ok(()), + Err(_) if path.is_dir() => Ok(()), Err(e) => Err(e), } } @@ -2280,7 +2279,7 @@ mod tests { #[test] fn concurrent_recursive_mkdir() { - for _ in 0..100 { + for _ in 0..50 { let mut dir = tmpdir().join("a"); for _ in 0..100 { dir = dir.join("a"); |
