blob: fc32fa92d16e11d8e5cdeadbe26ceaccc078004e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
use crate::file_handler::{File, FileHandler};
use std::fs::read_dir;
use std::path::PathBuf;
pub fn find_files(directory_path: PathBuf) -> Vec<File> {
let mut result: Vec<File> = vec![];
let file_handler = FileHandler::default();
let entries = read_dir(directory_path).unwrap();
for entry in entries {
let path = entry.unwrap().path();
if path.starts_with(".") && !path.starts_with(".well-known") {
continue;
}
if path.is_dir() {
result.append(&mut find_files(path))
} else {
let file_type = file_handler.identify(&path);
result.push(File {
path: path,
file_type: file_type,
});
}
}
return result;
}
|