Skip to content

Commit

Permalink
Delete _book folder if it exists from previous runs
Browse files Browse the repository at this point in the history
  • Loading branch information
mdinger committed May 13, 2015
1 parent c2b30b8 commit e5efea4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/rustbook/build.rs
Expand Up @@ -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| {
Expand Down

0 comments on commit e5efea4

Please sign in to comment.