From cb577c42624720740e382c9336510807f67ca0ca Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 1 Dec 2017 13:42:13 -0700 Subject: [PATCH] fix(includes): Support including hidden files When everything was mixed into `_layouts`, people marked their includes with a `_` prefix. This caused them not to be found when migrated over. This probably means `.` files are visible. Its unlikely there will be ones here that will cause problems, so it should be fine. --- src/template.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/template.rs b/src/template.rs index 7d45e7f..77ee0da 100644 --- a/src/template.rs +++ b/src/template.rs @@ -28,8 +28,10 @@ impl InMemoryTemplateRepository { /// Overwrites previous, conflicting snippets fn load_from_pathbuf(mut self, root: path::PathBuf) -> Result { - let template_files = files::FilesBuilder::new(&root)?; - let template_files = template_files.build()?; + debug!("Loading snippets from {:?}", root); + let template_files = files::FilesBuilder::new(&root)? + .ignore_hidden(false)? + .build()?; for file_path in template_files.files() { let rel_path = file_path .strip_prefix(root.as_path()) @@ -37,6 +39,7 @@ impl InMemoryTemplateRepository { .to_str() .expect("only UTF-8 characters supported in paths") .to_owned(); + trace!("Loading snippet {:?}", rel_path); let content = files::read_file(file_path)?; self.templates.insert(rel_path, content); }