Skip to content

Commit

Permalink
refactor: implement pr feedback - create directory if it doesn't exist
Browse files Browse the repository at this point in the history
Co-authored-by: Mitchell Mosure <[email protected]>
  • Loading branch information
cs50victor and mosure authored Jan 8, 2024
1 parent caacf84 commit 114f995
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions examples/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,13 @@ mod frame_capture {
Ok(img) => img.to_rgba8(),
Err(e) => panic!("Failed to create image buffer {e:?}"),
};
let images_path =

let images_dir =
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("test_images");
std::fs::create_dir_all(&images_dir).unwrap();

let uuid = bevy::utils::Uuid::new_v4();
let image_path = images_path.join(format!("{uuid}.png"));
let image_path = images_dir.join(format!("{uuid}.png"));
if let Err(e) = img.save(image_path){
panic!("Failed to save image: {}", e);
};
Expand Down

0 comments on commit 114f995

Please sign in to comment.