mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-08 01:28:18 +03:00
Delete _book folder if it exists from previous runs
This commit is contained in:
@@ -183,6 +183,12 @@ fn execute(&mut self, term: &mut Term) -> CommandResult<()> {
|
||||
tgt = PathBuf::from(&env::args().nth(3).unwrap());
|
||||
}
|
||||
|
||||
// `_book` directory may already exist from previous runs. Check and
|
||||
// delete it if it exists.
|
||||
for entry in try!(fs::read_dir(&cwd)) {
|
||||
let path = try!(entry).path();
|
||||
if path == tgt { try!(fs::remove_dir_all(&tgt)) }
|
||||
}
|
||||
try!(fs::create_dir(&tgt));
|
||||
|
||||
try!(File::create(&tgt.join("rust-book.css")).and_then(|mut f| {
|
||||
|
||||
Reference in New Issue
Block a user