Add check in StoreId::new() whether the local part is absolute

This commit is contained in:
Matthias Beyer 2016-08-25 14:27:42 +02:00
parent ccc2b6b735
commit d1f07cd087

View file

@ -20,8 +20,15 @@ pub struct StoreId {
impl StoreId {
pub fn new(base: Option<PathBuf>, id: PathBuf) -> StoreId {
StoreId { base: base, id: id }
pub fn new(base: Option<PathBuf>, id: PathBuf) -> Result<StoreId> {
if id.is_absolute() {
Err(SEK::StoreIdLocalPartAbsoluteError.into_error())
} else {
Ok(StoreId {
base: base,
id: id
})
}
}
pub fn storified(self, store: &Store) -> StoreId {