Add StoreId::new_baseless()

This commit is contained in:
Matthias Beyer 2016-08-25 14:29:15 +02:00
parent d1f07cd087
commit ab23d04e04

View file

@ -21,11 +21,15 @@ pub struct StoreId {
impl StoreId {
pub fn new(base: Option<PathBuf>, id: PathBuf) -> Result<StoreId> {
StoreId::new_baseless(id).map(|mut sid| { sid.base = base; sid })
}
pub fn new_baseless(id: PathBuf) -> Result<StoreId> {
if id.is_absolute() {
Err(SEK::StoreIdLocalPartAbsoluteError.into_error())
} else {
Ok(StoreId {
base: base,
base: None,
id: id
})
}