From bb827c3928ee6fc56c04e503be9f39ae70efee67 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 19 Feb 2026 10:09:18 +0000 Subject: feat: Refactor code structure and enhance functionality across multiple crates --- crates/common/src/lib.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'crates/common') 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 { Ok(()) } } + +/// Recursively collects all files under `root`. +pub fn collect_files_recursive(root: &Path, out: &mut Vec) { + 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); + } + } +} -- cgit v1.2.3