Skip to content

Commit f9dd8c2

Browse files
author
Inkedstinct
committed
fix(results) : Delete aggregated files if already exists (previously concatenating)
1 parent 6461709 commit f9dd8c2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/results.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use thiserror::Error;
2-
use log::{debug, warn};
2+
use log::{debug, warn, error};
33
use serde::{Serialize, Deserialize};
44
use std::path::{Path, PathBuf};
55
use std::fs::File;
@@ -224,6 +224,12 @@ fn aggregate_hwpc(
224224
let (output_parent, output_basename) = (raw_results_dir_path.parent().unwrap(), raw_results_dir_path.file_name().unwrap());
225225
let output_path = &format!("{}/{}.csv", output_parent.to_str().unwrap(), output_basename.to_str().unwrap());
226226

227+
if Path::new(output_path).exists() {
228+
match fs::remove_file(output_path) {
229+
Ok(_) => debug!("File '{}' was deleted successfully.", output_path),
230+
Err(e) => error!("Failed to delete file '{}': {}", output_path, e),
231+
}
232+
}
227233

228234
let mut raw_results_subdirs = Vec::new();
229235

0 commit comments

Comments
 (0)