From 8dff5685fddbb76f24a229d2979966a448945214 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 7 Aug 2016 16:53:33 +0200 Subject: [PATCH] Make StoreId.base optional --- libimagstore/src/storeid.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libimagstore/src/storeid.rs b/libimagstore/src/storeid.rs index 741a58d2..52388d84 100644 --- a/libimagstore/src/storeid.rs +++ b/libimagstore/src/storeid.rs @@ -15,8 +15,8 @@ use store::Store; /// The Index into the Store #[derive(Debug, Clone, PartialEq, Hash, Eq, PartialOrd, Ord)] pub struct StoreId { - store_location: PathBuf, - id: PathBuf, + base: Option, + id: PathBuf, } impl StoreId { @@ -28,7 +28,7 @@ impl StoreId { } else { debug!("Create new store id out of: {:?} and {:?}", store.path(), self.id); - let new_id = StoreId { store_location: store.path().clone(), self.id }; + let new_id = StoreId { base: Some(store.path().clone()), self.id }; debug!("Created: '{:?}'", new_id); new_id @@ -53,7 +53,7 @@ impl StoreId { impl Into for StoreId { fn into(self) -> PathBuf { - let mut base = self.store_location; + let mut base = self.base.unwrap_or(PathBuf::from("/")); base.push(self.id); base }