aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index d031496..1076441 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -125,12 +125,14 @@ fn get_longitude(reader: &exif::Reader) -> Result<f64> {
enum Property {
Filename,
+ Path,
}
impl std::fmt::Display for Property {
fn fmt(&self, w: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Property::Filename => write!(w, "filename"),
+ Property::Path => write!(w, "path"),
}
}
}
@@ -149,7 +151,11 @@ fn get_feature(filename: &Path, properties: &[Property]) -> Result<Feature> {
for prop in properties {
let key = prop.to_string();
let value = match prop {
- Property::Filename => to_value(filename.file_name().unwrap().to_string_lossy())
+ Property::Filename => to_value(filename.file_name().unwrap().to_string_lossy()),
+ Property::Path => {
+ let path = filename.canonicalize()?;
+ to_value(path.to_string_lossy())
+ }
};
props.insert(key, value.unwrap());
}
@@ -189,6 +195,7 @@ fn main() {
for prop in requested_properties {
match prop {
"filename" => valid_properties.push(Property::Filename),
+ "path" => valid_properties.push(Property::Path),
_ => {
eprintln!("unknown property: {}", prop);
std::process::exit(1);