diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-05-14 19:33:09 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-05-14 19:33:09 +0530 |
| commit | ca225df7f328a574638ca45ff2c0c15ff8aeabd2 (patch) | |
| tree | a77eaf82e695f88b0dd463b561a1f293b985512c /src | |
| parent | b1bd3a3c5180b2d671e5810cb5211b2d2b456a71 (diff) | |
| parent | e5efea4eb3a75db539fd267ae2574278ec6838bd (diff) | |
| download | rust-ca225df7f328a574638ca45ff2c0c15ff8aeabd2.tar.gz rust-ca225df7f328a574638ca45ff2c0c15ff8aeabd2.zip | |
Rollup merge of #25354 - mdinger:delete_book, r=steveklabnik
rustbook throws errors if the `_book` folder exists already. Common if you build twice in a row. Identical to https://github.com/steveklabnik/rustbook/issues/20
Diffstat (limited to 'src')
| -rw-r--r-- | src/rustbook/build.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/rustbook/build.rs b/src/rustbook/build.rs index f96704ee128..47bdc9335c4 100644 --- a/src/rustbook/build.rs +++ b/src/rustbook/build.rs @@ -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| { |
