diff options
author | James Campos <james.r.campos@gmail.com> | 2020-05-18 03:13:45 -0700 |
---|---|---|
committer | James Campos <james.r.campos@gmail.com> | 2020-05-18 03:13:45 -0700 |
commit | d6c5913c3ea1c71966119f2bbf01f69b2c301a8f (patch) | |
tree | efab3a76808cbae85e851f4987ab941bb4fa244e /src | |
parent | 056aba27aabf7261ba1fbfd7bcf2b953765fa298 (diff) | |
download | bk-d6c5913c3ea1c71966119f2bbf01f69b2c301a8f.tar.gz |
canonicalize
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 12 |
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)) } } } |