From a07835bbe305746cc87625528d090852e11b9000 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Tue, 12 Sep 2017 15:57:51 +0900 Subject: [PATCH] Ignore folder change on live reload. Close #118 --- src/cmd/serve.rs | 2 +- src/rebuild.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/cmd/serve.rs b/src/cmd/serve.rs index 6107e81..ec5100d 100644 --- a/src/cmd/serve.rs +++ b/src/cmd/serve.rs @@ -160,7 +160,7 @@ pub fn serve(interface: &str, port: &str, config_file: &str) -> Result<()> { Write(path) | Remove(path) | Rename(_, path) => { - if is_temp_file(&path) { + if is_temp_file(&path) || path.is_dir() { continue; } diff --git a/src/rebuild.rs b/src/rebuild.rs index e775dd5..bfb3b75 100644 --- a/src/rebuild.rs +++ b/src/rebuild.rs @@ -98,6 +98,11 @@ pub fn after_content_change(site: &mut Site, path: &Path) -> Result<()> { // A page or section got deleted if !path.exists() { + // A folder got deleted, ignore this event + if !site.sections.contains_key(path) && !site.pages.contains_key(path) { + return Ok(()); + } + if is_section { // A section was deleted, many things can be impacted: // - the pages of the section are becoming orphans