1 use crate::file_handler::{File, FileHandler};
3 use std::path::PathBuf;
5 pub fn find_files(directory_path: &PathBuf) -> Vec<File> {
6 return find_files_recursively(directory_path, directory_path);
9 fn find_files_recursively(root_path: &PathBuf, directory_path: &PathBuf) -> Vec<File> {
10 let mut result: Vec<File> = vec![];
11 let file_handler = FileHandler::default();
12 let entries = read_dir(&directory_path).unwrap();
13 for entry in entries {
14 let path = entry.unwrap().path();
15 let relative_path = path.strip_prefix(&root_path).unwrap();
16 if relative_path.starts_with(".git") || relative_path.starts_with(".gitignore") {
20 result.append(&mut find_files_recursively(&root_path, &path))
22 let file_type = file_handler.identify(&path);