Make StoreId.base optional
This commit is contained in:
parent
ad92b05fb4
commit
8dff5685fd
1 changed files with 4 additions and 4 deletions
|
@ -15,8 +15,8 @@ use store::Store;
|
||||||
/// The Index into the Store
|
/// The Index into the Store
|
||||||
#[derive(Debug, Clone, PartialEq, Hash, Eq, PartialOrd, Ord)]
|
#[derive(Debug, Clone, PartialEq, Hash, Eq, PartialOrd, Ord)]
|
||||||
pub struct StoreId {
|
pub struct StoreId {
|
||||||
store_location: PathBuf,
|
base: Option<PathBuf>,
|
||||||
id: PathBuf,
|
id: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StoreId {
|
impl StoreId {
|
||||||
|
@ -28,7 +28,7 @@ impl StoreId {
|
||||||
} else {
|
} else {
|
||||||
debug!("Create new store id out of: {:?} and {:?}", store.path(), self.id);
|
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);
|
debug!("Created: '{:?}'", new_id);
|
||||||
new_id
|
new_id
|
||||||
|
@ -53,7 +53,7 @@ impl StoreId {
|
||||||
impl Into<PathBuf> for StoreId {
|
impl Into<PathBuf> for StoreId {
|
||||||
|
|
||||||
fn into(self) -> PathBuf {
|
fn into(self) -> PathBuf {
|
||||||
let mut base = self.store_location;
|
let mut base = self.base.unwrap_or(PathBuf::from("/"));
|
||||||
base.push(self.id);
|
base.push(self.id);
|
||||||
base
|
base
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue