Skip to content

Commit f15a43b

Browse files
committed
fix: create directory for json output
1 parent 9ee4c9a commit f15a43b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/project/generate_output.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,15 @@ pub async fn generate_output(
5454
}
5555
}
5656
OutputFormat::Json => {
57-
let json_path = Path::new(output_directory).join("report.json");
57+
if let Err(e) = fs::create_dir_all(output_directory).await {
58+
eprintln!(
59+
"Error creating output directory {}: {:?}",
60+
output_directory, e
61+
);
62+
return;
63+
}
64+
65+
let json_path = Path::new(output_directory).join("index.json");
5866
let mut file = File::create(&json_path)
5967
.expect("Failed to create JSON report file");
6068
let formatted_json = serde_json::to_string_pretty(&json_data)

0 commit comments

Comments
 (0)