From b44a40bffa2f5cad5437b2c652e824183e7831bb Mon Sep 17 00:00:00 2001 From: Zoey Date: Thu, 19 Aug 2021 14:13:17 -0700 Subject: [PATCH] Copy root files while serving --- src/serving.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/serving.rs b/src/serving.rs index 7df525a..6d70e43 100644 --- a/src/serving.rs +++ b/src/serving.rs @@ -18,7 +18,7 @@ use warp::{ Filter, }; -use crate::{Site, SiteBuilder, PAGES_PATH, SASS_PATH, STATIC_PATH, TEMPLATES_PATH}; +use crate::{Site, SiteBuilder, PAGES_PATH, ROOT_PATH, SASS_PATH, STATIC_PATH, TEMPLATES_PATH}; fn with_build_path( build_path: PathBuf, @@ -74,6 +74,8 @@ fn create( if build { builder.build_sass().context("Failed to rebuild Sass")?; } + } else if let Ok(root_path) = relative_path.strip_prefix(ROOT_PATH) { + std::fs::copy(&path, builder.build_path.join(root_path))?; } Ok(()) @@ -106,6 +108,8 @@ fn remove(builder: &mut SiteBuilder, path: &Path, relative_path: &Path) -> anyho builder.build_sass().context("Failed to rebuild Sass")?; } + // Removing root files is not handled for the time being. + Ok(()) }