Skip to content

Commit

Permalink
fix: create directory for json output
Browse files Browse the repository at this point in the history
  • Loading branch information
azat-io committed Nov 3, 2024
1 parent 9ee4c9a commit f15a43b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/project/generate_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@ pub async fn generate_output(
}
}
OutputFormat::Json => {
let json_path = Path::new(output_directory).join("report.json");
if let Err(e) = fs::create_dir_all(output_directory).await {
eprintln!(
"Error creating output directory {}: {:?}",
output_directory, e
);
return;
}

let json_path = Path::new(output_directory).join("index.json");
let mut file = File::create(&json_path)
.expect("Failed to create JSON report file");
let formatted_json = serde_json::to_string_pretty(&json_data)
Expand Down

0 comments on commit f15a43b

Please sign in to comment.