Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/bin/compress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ fn main() {
"invs": step_results.iter().map(|inv| inv.json()).collect::<Vec<serde_json::Value>>(),
});

std::fs::write(&args.out, serde_json::to_string_pretty(&out).unwrap()).unwrap();
println!("Wrote to {:?}",args.out);
let out_path = &args.out;
if let Some(out_path_dir) = out_path.parent() {
if !out_path_dir.exists() {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The double if is a bit ugly but it's necessary because "if"s and "if let"s are disjoint. Rust has implemented a fix to this (see here), but it's not in the stable branch yet.

std::fs::create_dir_all(out_path_dir).unwrap();
}
}
std::fs::write(out_path, serde_json::to_string_pretty(&out).unwrap()).unwrap();
println!("Wrote to {:?}", out_path);
}