diff options
Diffstat (limited to 'src/picture.rs')
-rw-r--r-- | src/picture.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/picture.rs b/src/picture.rs index 76a33df..3f78f90 100644 --- a/src/picture.rs +++ b/src/picture.rs @@ -11,6 +11,7 @@ use crate::context::Context; #[derive(Debug)] pub enum LoadError { + PathError, Io(io::Error), ExifParser(exif::Error) } @@ -26,6 +27,7 @@ pub struct Picture { pub taken: Option<String>, hash: String, pub path: PathBuf, + pub file_name: String, } pub struct Converter<'a> { @@ -72,6 +74,10 @@ impl Picture { taken, hash: hash_reader(&mut reader)?, path: path.to_path_buf(), + file_name: match path.file_name() { + Some(fname) => Ok(fname.to_string_lossy().to_string()), + None => Err(LoadError::PathError), + }?, }) } |