Skip to content

Commit

Permalink
fix: directories were not being created if they did not exist
Browse files Browse the repository at this point in the history
accidentally removed this logic when refactoring

Signed-off-by: Brend Smits <[email protected]>
  • Loading branch information
Brend-Smits committed Apr 19, 2023
1 parent 20f8ad5 commit ffdf7ba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::fs::File;
use std::fs::{self, File};
use std::io::{BufRead, BufReader, BufWriter, Write};

use clap::Parser;
Expand Down Expand Up @@ -130,6 +130,9 @@ async fn fetch_sbom(
)));
}
};
let parts = repo_name.split('/').collect::<Vec<&str>>();
fs::create_dir_all(format!("{}/{}", sbom_save_directory_path, &parts[0]))
.expect("Could not create directory");
let sbom_save_directory_path = format!("{}/{}.json", sbom_save_directory_path, repo_name);
save_sbom_to_file(repo_name, &response_text, &sbom_save_directory_path)?;
println!("{:#?}", spdx.to_string());
Expand Down

0 comments on commit ffdf7ba

Please sign in to comment.