aboutsummaryrefslogtreecommitdiff
path: root/tools/cru-py/cru/template.py
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2024-11-11 01:12:29 +0800
committerYuqian Yang <crupest@crupest.life>2025-01-20 23:24:41 +0800
commit90a72d2d7ed4a5eadfe36f62d81f26ca3324e49b (patch)
tree0e5241878de3fc7cd36e4e5bcd2eac3ae1b063f6 /tools/cru-py/cru/template.py
parent907eff64f175822e1113887a8b547490dadf9687 (diff)
downloadcrupest-90a72d2d7ed4a5eadfe36f62d81f26ca3324e49b.tar.gz
crupest-90a72d2d7ed4a5eadfe36f62d81f26ca3324e49b.tar.bz2
crupest-90a72d2d7ed4a5eadfe36f62d81f26ca3324e49b.zip
HALF WORK: 2024.1.20 - 4
Diffstat (limited to 'tools/cru-py/cru/template.py')
-rw-r--r--tools/cru-py/cru/template.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/cru-py/cru/template.py b/tools/cru-py/cru/template.py
index 74a5c9a..9f0b560 100644
--- a/tools/cru-py/cru/template.py
+++ b/tools/cru-py/cru/template.py
@@ -142,6 +142,11 @@ class TemplateTree:
) -> None:
for file, template in self.templates:
des = CruPath(destination) / file
+ if self.template_file_suffix is not None and des.name.endswith(
+ self.template_file_suffix
+ ):
+ des = des.parent / (des.name[: -len(self.template_file_suffix)])
+
text = template.generate(variables)
if not dry_run:
des.parent.mkdir(parents=True, exist_ok=True)