fix: print error on failed to read metadata
this should be very rare, so no need to display it or abort
This commit is contained in:
parent
808a8bf31d
commit
1f909904c2
1 changed files with 7 additions and 5 deletions
12
src/main.rs
12
src/main.rs
|
|
@ -194,11 +194,13 @@ impl State {
|
||||||
path.as_ref()
|
path.as_ref()
|
||||||
.file_name()
|
.file_name()
|
||||||
.map_or(Cow::Borrowed("[no file]"), OsStr::to_string_lossy),
|
.map_or(Cow::Borrowed("[no file]"), OsStr::to_string_lossy),
|
||||||
path.as_ref()
|
path.as_ref().metadata().map_or_else(
|
||||||
.metadata()
|
|e| {
|
||||||
.map_or(Cow::Borrowed("[no size]"), |m| Cow::Owned(
|
eprintln!("failed to read metadata: {e}");
|
||||||
Size::from_bytes(m.size()).to_string()
|
Cow::Borrowed("[no size]")
|
||||||
)),
|
},
|
||||||
|
|m| Cow::Owned(Size::from_bytes(m.size()).to_string())
|
||||||
|
),
|
||||||
image.width(),
|
image.width(),
|
||||||
image.height(),
|
image.height(),
|
||||||
));
|
));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue