Skip to content

Commit

Permalink
generate parent folders of report if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiragKumar9 committed Oct 21, 2024
1 parent 79c1610 commit 810c8df
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::any::TypeId;
use std::cell::RefCell;
use std::collections::HashMap;
use std::env;
use std::fs;
use std::fs::File;
use std::path::PathBuf;

Expand Down Expand Up @@ -32,7 +33,11 @@ impl ConfigReportOptions {
self
}
/// Sets the directory where reports will be output
/// # Panics
/// if the directory in which the report is to be stored does not exist and cannot be created
pub fn directory(&mut self, directory: PathBuf) -> &mut ConfigReportOptions {
// if the directory does not exist, create it
fs::create_dir_all(directory.clone()).expect("Failed to create directory");
self.directory = directory;
self
}
Expand Down

0 comments on commit 810c8df

Please sign in to comment.