diff options
Diffstat (limited to 'src/filestore/path.rs')
-rw-r--r-- | src/filestore/path.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/filestore/path.rs b/src/filestore/path.rs index 9a3e193..25ffbd9 100644 --- a/src/filestore/path.rs +++ b/src/filestore/path.rs @@ -11,8 +11,12 @@ use anyhow::Context; pub struct StoreRoot(PathBuf); impl StoreRoot { - pub (in crate::filestore) fn new(root: PathBuf) -> Self { - StoreRoot(root) + pub (in crate::filestore) fn new(root: PathBuf) -> Result<Self> { + if root.is_absolute() { + Ok(StoreRoot(root)) + } else { + Err(anyhow!("StoreRoot path is not absolute: {}", root.display())) + } } pub (in crate::filestore) fn stripped_from(&self, pb: &Path) -> Result<ArtifactPath> { |