From ab23d04e0471ab1891561086f2969b87b74fa31a Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 25 Aug 2016 14:29:15 +0200 Subject: [PATCH] Add StoreId::new_baseless() --- libimagstore/src/storeid.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libimagstore/src/storeid.rs b/libimagstore/src/storeid.rs index 94eb0c4a..8b2d9d60 100644 --- a/libimagstore/src/storeid.rs +++ b/libimagstore/src/storeid.rs @@ -21,11 +21,15 @@ pub struct StoreId { impl StoreId { pub fn new(base: Option, id: PathBuf) -> Result { + StoreId::new_baseless(id).map(|mut sid| { sid.base = base; sid }) + } + + pub fn new_baseless(id: PathBuf) -> Result { if id.is_absolute() { Err(SEK::StoreIdLocalPartAbsoluteError.into_error()) } else { Ok(StoreId { - base: base, + base: None, id: id }) }