|
|
@@ -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}"))?;
|
|
|
|