Skip to content

Commit

Permalink
fix: Strip .tpl from target path when loading files
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Oct 15, 2021
1 parent 5530ef3 commit 47c2241
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,15 @@ pub fn get_files(dir: &Path) -> Result<Vec<File>, 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,
}
Expand Down

0 comments on commit 47c2241

Please sign in to comment.