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.
This commit is contained in:
Ed Page 2017-12-01 13:42:13 -07:00
parent a99ca19756
commit cb577c4262

View file

@ -28,8 +28,10 @@ impl InMemoryTemplateRepository {
/// Overwrites previous, conflicting snippets
fn load_from_pathbuf(mut self, root: path::PathBuf) -> Result<Self> {
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);
}