From 47c2241c9d408639b3accaac9b7f89a94a8e64e9 Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Fri, 15 Oct 2021 23:18:40 +0100 Subject: [PATCH] fix: Strip .tpl from target path when loading files --- src/core/file.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/core/file.rs b/src/core/file.rs index 2d880cb..c601382 100644 --- a/src/core/file.rs +++ b/src/core/file.rs @@ -85,9 +85,15 @@ pub fn get_files(dir: &Path) -> Result, errors::Error> { let name = e.file_name().to_string_lossy(); let is_template = name.ends_with(".tpl"); + let target_path = if is_template { + e.path().with_extension("") + } else { + e.path().to_owned() + }; + File { group: group.clone(), - relative_path: e.path().strip_prefix(dir).unwrap().to_owned(), + relative_path: target_path.strip_prefix(dir).unwrap().to_owned(), source_path: e.path().to_owned(), is_template, }