From 40f8002ea95659698cd328753ac7c98c79a8ba03 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 7 Dec 2020 13:31:35 +0100 Subject: Remove StoreRoot::join_path() Reduce mis-use possibilities by removing the join_path() method for StoreRoot. Signed-off-by: Matthias Beyer --- src/filestore/path.rs | 9 ++++++--- src/filestore/staging.rs | 2 +- src/filestore/util.rs | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/filestore/path.rs b/src/filestore/path.rs index ea06608..fd79e1b 100644 --- a/src/filestore/path.rs +++ b/src/filestore/path.rs @@ -25,9 +25,12 @@ impl StoreRoot { FullArtifactPath(&self, ap) } - // Needed for FileStoreImpl::path_exists_in_store_root() - pub (in crate::filestore) fn join_path(&self, p: &Path) -> PathBuf { - self.0.join(p) + pub fn is_file(&self, subpath: &Path) -> bool { + self.0.join(subpath).is_file() + } + + pub fn is_dir(&self, subpath: &Path) -> bool { + self.0.join(subpath).is_dir() } pub fn display(&self) -> std::path::Display { diff --git a/src/filestore/staging.rs b/src/filestore/staging.rs index 992a612..df7e006 100644 --- a/src/filestore/staging.rs +++ b/src/filestore/staging.rs @@ -66,7 +66,7 @@ impl StagingStore { .into_iter() .inspect(|p| trace!("Trying to load into staging store: {}", p.display())) .filter_map(|path| { - if self.0.root.join_path(&path).is_dir() { + if self.0.root.is_dir(&path) { None } else { Some({ diff --git a/src/filestore/util.rs b/src/filestore/util.rs index 1899c18..0eb430e 100644 --- a/src/filestore/util.rs +++ b/src/filestore/util.rs @@ -55,7 +55,7 @@ impl FileStoreImpl { } pub fn path_exists_in_store_root(&self, p: &Path) -> bool { - self.root.join_path(p).is_file() + self.root.is_file(p) } pub (in crate::filestore) fn values(&self) -> impl Iterator { -- cgit v1.2.3