Skip to content
This repository was archived by the owner on Aug 20, 2021. It is now read-only.

Commit 8c3ed02

Browse files
authored
Merge pull request #17 from Aaronepower/master
Added Windows remove_dir_all implementation from #31944
2 parents 62b9aba + 0819b71 commit 8c3ed02

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ appveyor = { repository = "rust-lang-libs/tempdir" }
2222

2323
[dependencies]
2424
rand = "0.3"
25+
remove_dir_all = "0.2"
26+

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@
5858
//! ```
5959
6060
extern crate rand;
61+
extern crate remove_dir_all;
6162

6263
use std::env;
6364
use std::io::{self, Error, ErrorKind};
6465
use std::fmt;
6566
use std::fs;
6667
use std::path::{self, PathBuf, Path};
6768
use rand::{thread_rng, Rng};
69+
use remove_dir_all::remove_dir_all;
6870

6971
/// A directory in the filesystem that is automatically deleted when
7072
/// it goes out of scope.
@@ -321,7 +323,7 @@ impl TempDir {
321323
/// # }
322324
/// ```
323325
pub fn close(mut self) -> io::Result<()> {
324-
let result = fs::remove_dir_all(self.path());
326+
let result = remove_dir_all(self.path());
325327

326328
// Prevent the Drop impl from removing the dir a second time.
327329
self.path = None;
@@ -348,7 +350,7 @@ impl Drop for TempDir {
348350
fn drop(&mut self) {
349351
// Path is `None` if `close()` or `into_path()` has been called.
350352
if let Some(ref p) = self.path {
351-
let _ = fs::remove_dir_all(p);
353+
let _ = remove_dir_all(p);
352354
}
353355
}
354356
}

0 commit comments

Comments
 (0)