use parsed file_path instead of passed argument

This commit is contained in:
Veneficium 2025-11-10 18:16:01 +01:00
parent f1bde5df89
commit 7a2d159ee1

View file

@ -176,18 +176,18 @@ fn main() -> anyhow::Result<()> {
} }
let mut app = App::default(); let mut app = App::default();
let image = let image = ImageReader::open(file_path)
ImageReader::open(file_path).context(format!("Failed to open image at {}", args[1]))?; .context(format!("Failed to open image at {}", file_path.display()))?;
app.file_name = file_path.file_name().unwrap().to_str().unwrap().to_string(); app.file_name = file_path.file_name().unwrap().to_str().unwrap().to_string();
match image.format().unwrap() { match image.format().unwrap() {
ImageFormat::Gif => { ImageFormat::Gif => {
let mut animation = Animation::default(); let mut animation = Animation::default();
let file = BufReader::new( let file = BufReader::new(File::open(file_path).context(format!(
File::open(args[1].clone()) "Failed to open GIF file at {}",
.context(format!("Failed to open GIF file at {}", args[1]))?, file_path.display()
); ))?);
let decoder = GifDecoder::new(file).context("Failed to create GIF decoder")?; let decoder = GifDecoder::new(file).context("Failed to create GIF decoder")?;
let frames = decoder let frames = decoder
.into_frames() .into_frames()