Delete _book folder if it exists from previous runs

This commit is contained in:
mdinger 2015-05-13 00:06:52 -04:00
parent c2b30b86df
commit e5efea4eb3

View File

@ -183,6 +183,12 @@ impl Subcommand for Build {
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| {