Add StoreId::into_pathbuf()

This commit is contained in:
Matthias Beyer 2016-09-05 16:32:50 +02:00
parent b8f612632d
commit a313cede06

View file

@ -62,6 +62,17 @@ impl StoreId {
self
}
/// Transform the StoreId object into a PathBuf, error if the base of the StoreId is not
/// specified.
pub fn into_pathbuf(self) -> Result<PathBuf> {
self.base
.ok_or(SEK::StoreIdHasNoBaseError.into_error())
.map(|mut base| {
base.push(self.id);
base
})
}
pub fn exists(&self) -> bool {
let pb : PathBuf = self.clone().into();
pb.exists()