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 image =
ImageReader::open(file_path).context(format!("Failed to open image at {}", args[1]))?;
let image = ImageReader::open(file_path)
.context(format!("Failed to open image at {}", file_path.display()))?;
app.file_name = file_path.file_name().unwrap().to_str().unwrap().to_string();
match image.format().unwrap() {
ImageFormat::Gif => {
let mut animation = Animation::default();
let file = BufReader::new(
File::open(args[1].clone())
.context(format!("Failed to open GIF file at {}", args[1]))?,
);
let file = BufReader::new(File::open(file_path).context(format!(
"Failed to open GIF file at {}",
file_path.display()
))?);
let decoder = GifDecoder::new(file).context("Failed to create GIF decoder")?;
let frames = decoder
.into_frames()