Skip to content

Commit fb1513c

Browse files
Create output path if it doesn't exist (#68)
* create output path if it doesn't exist * create full path * revert change to create_dir_all and add error message Co-authored-by: Felix Mölder <felix.moelder@uni-due.de>
1 parent ef5128c commit fb1513c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ fn main() -> Result<(), Box<dyn Error>> {
7777
let mut sample_calls = HashMap::new();
7878
let mut bam_paths = HashMap::new();
7979
let output_path = matches.value_of("output-path").unwrap();
80+
if !Path::new(output_path).exists() {
81+
fs::create_dir(Path::new(output_path)).unwrap_or_else(|_| {
82+
panic!(
83+
"Couldn't create output directory at {}. Please make sure the path exists.",
84+
output_path
85+
)
86+
});
87+
}
8088
let max_cells = u32::from_str(matches.value_of("max-cells").unwrap()).unwrap();
8189
let custom_js = matches.value_of("custom-js");
8290
bcf::report::embed_js(output_path, custom_js)?;

0 commit comments

Comments
 (0)