diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-12-07 13:31:35 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-12-07 13:31:35 +0100 |
commit | 40f8002ea95659698cd328753ac7c98c79a8ba03 (patch) | |
tree | e07516d17f0a72eabbf758a6d4c78ea25ac876e9 | |
parent | 2a019c8bf622e1943b6d3209728570753d4bece0 (diff) |
Remove StoreRoot::join_path()
Reduce mis-use possibilities by removing the join_path() method for
StoreRoot.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
-rw-r--r-- | src/filestore/path.rs | 9 | ||||
-rw-r--r-- | src/filestore/staging.rs | 2 | ||||
-rw-r--r-- | src/filestore/util.rs | 2 |
3 files changed, 8 insertions, 5 deletions
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<Item = &Artifact> { |