summaryrefslogtreecommitdiffstats
path: root/src/repository
diff options
context:
space:
mode:
Diffstat (limited to 'src/repository')
-rw-r--r--src/repository/fs.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/repository/fs.rs b/src/repository/fs.rs
index a865f3f..c648126 100644
--- a/src/repository/fs.rs
+++ b/src/repository/fs.rs
@@ -106,6 +106,25 @@ impl FileSystemRepresentation {
Ok(fsr)
}
+
+ pub fn get_files_for<'a>(&'a self, path: &Path) -> Result<Vec<&'a String>> {
+ let mut res = Vec::with_capacity(10); // good enough
+
+ let mut curr_hm = &self.elements;
+ for elem in path.components() {
+ let elem = PathComponent::try_from(&elem)?;
+
+ match curr_hm.get(&elem) {
+ Some(Element::File(cont)) => res.push(cont),
+ Some(Element::Dir(hm)) => curr_hm = hm,
+ None => {
+ unimplemented!()
+ },
+ }
+ }
+
+ Ok(res)
+ }
}
fn is_pkgtoml(entry: &DirEntry) -> bool {