From 5ae98346a080061617609e3b7181d05e05ab145c Mon Sep 17 00:00:00 2001 From: John Breaux Date: Sun, 30 Apr 2023 00:55:56 -0500 Subject: [PATCH] chirp-imgui: Make sure ROM file exists. --- src/bin/chirp-imgui/main.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/bin/chirp-imgui/main.rs b/src/bin/chirp-imgui/main.rs index 629e06b..1cb03a6 100644 --- a/src/bin/chirp-imgui/main.rs +++ b/src/bin/chirp-imgui/main.rs @@ -10,6 +10,7 @@ mod gui; use crate::args::Arguments; use crate::emu::*; use crate::gui::*; +use owo_colors::OwoColorize; use pixels::{Pixels, SurfaceTexture}; use std::result::Result; use winit::dpi::LogicalSize; @@ -31,6 +32,15 @@ struct Application { fn main() -> Result<(), error::Error> { let args = Arguments::parse(); + // Make sure the ROM file exists + if !args.file.is_file() { + eprintln!( + "{} not found. If the file exists, you might not have permission you access it.", + args.file.display().italic().red() + ); + return Ok(()); + } + let event_loop = EventLoop::new(); let mut input = WinitInputHelper::new();