Fix Ref::get_path_hash() to use ::into_pathbuf()
This commit is contained in:
parent
a53adb854d
commit
a6377f322e
1 changed files with 13 additions and 5 deletions
|
@ -15,6 +15,7 @@ use libimagstore::storeid::StoreId;
|
|||
use libimagstore::storeid::IntoStoreId;
|
||||
use libimagstore::store::Store;
|
||||
use libimagerror::into::IntoError;
|
||||
use libimagerror::trace::MapErrTrace;
|
||||
|
||||
use toml::Value;
|
||||
|
||||
|
@ -230,11 +231,18 @@ impl<'a> Ref<'a> {
|
|||
|
||||
/// Get the hash from the path of the ref
|
||||
pub fn get_path_hash(&self) -> Option<String> {
|
||||
let pb : PathBuf = self.0.get_location().clone().into();
|
||||
self.0
|
||||
.get_location()
|
||||
.clone()
|
||||
.into_pathbuf()
|
||||
.map_err_trace()
|
||||
.ok() // TODO: Hiding the error here is not so nice
|
||||
.and_then(|pb| {
|
||||
pb.file_name()
|
||||
.and_then(|osstr| osstr.to_str())
|
||||
.and_then(|s| s.split("~").next())
|
||||
.map(String::from)
|
||||
})
|
||||
}
|
||||
|
||||
/// Get the hash of the link target which is stored in the ref object
|
||||
|
|
Loading…
Reference in a new issue