summary refs log tree commit diff stats
path: root/src/new/section.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-06-13 06:43:41 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-06-13 06:43:41 +0200
commitb80182a348578fbe54cb8cd255b5087d75a44a7c (patch)
tree6dc42f16fd7c1b1cd69fa4ae40fa58560c2d3ecb /src/new/section.rs
parentfeat(config_file): Allow specifying the name of the `main.tex` file (diff)
downloadlpm-b80182a348578fbe54cb8cd255b5087d75a44a7c.tar.gz
lpm-b80182a348578fbe54cb8cd255b5087d75a44a7c.zip
fix(new::section): Avoid overriding already existing section file
Diffstat (limited to 'src/new/section.rs')
-rw-r--r--src/new/section.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/new/section.rs b/src/new/section.rs
index 86d347c..bfa2b2c 100644
--- a/src/new/section.rs
+++ b/src/new/section.rs
@@ -39,13 +39,13 @@ pub fn generate_new_section(
             ),
         );
 
-    let new_section_file = GeneratedFile::new(
+    file_tree.add_file(GeneratedFile::new_clobber(
         chapter_root
             .join("sections")
             .join(format!("{}.tex", MangledName::new(&name))),
         new_section_text,
-    );
-    file_tree.add_file(new_section_file);
+        false,
+    ));
 
     let chapter_file_path = chapter_root.join("chapter.tex");
     let mut chapter_file_text = fs::read_to_string(&chapter_file_path).with_context(|| {