diff --git a/src/book/mod.rs b/src/book/mod.rs index c8cab192..f464b496 100644 --- a/src/book/mod.rs +++ b/src/book/mod.rs @@ -190,9 +190,6 @@ impl MDBook { renderer.name().to_string(), ); - let name = renderer.name(); - let build_dir = self.build_dir_for(name); - for preprocessor in &self.preprocessors { if preprocessor_should_run(&**preprocessor, renderer, &self.config) { debug!("Running the {} preprocessor.", preprocessor.name()); diff --git a/src/renderer/html_handlebars/hbs_renderer.rs b/src/renderer/html_handlebars/hbs_renderer.rs index 16c884e1..7a7f0ef6 100644 --- a/src/renderer/html_handlebars/hbs_renderer.rs +++ b/src/renderer/html_handlebars/hbs_renderer.rs @@ -282,8 +282,10 @@ impl Renderer for HtmlHandlebars { let destination = &ctx.destination; let book = &ctx.book; - utils::remove_dir_contents(destination) - .chain_err(|| "Unable to remove stale HTML output")? + if destination.exists() { + utils::fs::remove_dir_content(destination) + .chain_err(|| "Unable to remove stale HTML output")?; + } trace!("render"); let mut handlebars = Handlebars::new();