Thomas пре 7 месеци
родитељ
комит
be475c2d4f
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      src/io/writers.rs

+ 5 - 0
src/io/writers.rs

@@ -17,6 +17,8 @@ pub fn get_gz_writer(path: &str, force: bool) -> anyhow::Result<BGZFWriter<File>
 
     let file = OpenOptions::new()
         .write(true) // Open the file for writing
+        .create_new(true)
+        .truncate(true)
         .open(path)
         .with_context(|| anyhow::anyhow!("failed to open the file: {path}"))?;
 
@@ -26,6 +28,9 @@ pub fn get_gz_writer(path: &str, force: bool) -> anyhow::Result<BGZFWriter<File>
 
 pub fn get_writer(path: &str) -> anyhow::Result<BufWriter<File>> {
     let file = OpenOptions::new()
+        .write(true) // Open the file for writing
+        .create_new(true)
+        .truncate(true)
         .open(path)
         .with_context(|| anyhow::anyhow!("failed to open the file: {path}"))?;