aboutsummaryrefslogtreecommitdiff
path: root/crates/common
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-02-19 13:09:18 +0300
committerValentin Popov <valentin@popov.link>2026-02-19 13:09:18 +0300
commitbb827c3928ee6fc56c04e503be9f39ae70efee67 (patch)
tree9d1af6595567517bcee3bddbcf7fefedce5dc5fe /crates/common
parentefab61a45c8837d3c2aaec464d8f6243fecb7a38 (diff)
downloadfparkan-bb827c3928ee6fc56c04e503be9f39ae70efee67.tar.xz
fparkan-bb827c3928ee6fc56c04e503be9f39ae70efee67.zip
feat: Refactor code structure and enhance functionality across multiple crates
Diffstat (limited to 'crates/common')
-rw-r--r--crates/common/src/lib.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/common/src/lib.rs b/crates/common/src/lib.rs
index 69796d3..c0d57f7 100644
--- a/crates/common/src/lib.rs
+++ b/crates/common/src/lib.rs
@@ -1,4 +1,6 @@
+use std::fs;
use std::io;
+use std::path::{Path, PathBuf};
/// Resource payload that can be either borrowed from mapped bytes or owned.
#[derive(Clone, Debug)]
@@ -42,3 +44,18 @@ impl OutputBuffer for Vec<u8> {
Ok(())
}
}
+
+/// Recursively collects all files under `root`.
+pub fn collect_files_recursive(root: &Path, out: &mut Vec<PathBuf>) {
+ let Ok(entries) = fs::read_dir(root) else {
+ return;
+ };
+ for entry in entries.flatten() {
+ let path = entry.path();
+ if path.is_dir() {
+ collect_files_recursive(&path, out);
+ } else if path.is_file() {
+ out.push(path);
+ }
+ }
+}