aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorJames Campos <james.r.campos@gmail.com>2020-05-18 03:13:45 -0700
committerJames Campos <james.r.campos@gmail.com>2020-05-18 03:13:45 -0700
commitd6c5913c3ea1c71966119f2bbf01f69b2c301a8f (patch)
treeefab3a76808cbae85e851f4987ab941bb4fa244e /src/main.rs
parent056aba27aabf7261ba1fbfd7bcf2b953765fa298 (diff)
downloadbk-d6c5913c3ea1c71966119f2bbf01f69b2c301a8f.tar.gz
canonicalize
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 73e8b33..f161007 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -456,16 +456,24 @@ fn restore(save_path: &str) -> Option<(String, usize, usize)> {
)
};
+ let canon = |s: String| {
+ std::fs::canonicalize(s)
+ .unwrap()
+ .to_str()
+ .unwrap()
+ .to_string()
+ };
+
match (save, path) {
(Err(_), None) => None,
- (Err(_), Some(path)) => Some((path, 0, 0)),
+ (Err(_), Some(path)) => Some((canon(path), 0, 0)),
(Ok(save), None) => Some(get_save(save)),
(Ok(save), Some(path)) => {
let save = get_save(save);
if path == save.0 {
Some(save)
} else {
- Some((path, 0, 0))
+ Some((canon(path), 0, 0))
}
}
}