scan_lib/
path_manipulation.rs

1pub fn exclude_unwanted_search_objects(paths: Vec<String>, exclude: &str) -> Vec<String> {
2    let mut new_paths = Vec::new();
3    for mut path in paths {
4        let actual_path: String = path.clone();
5        path = path.to_lowercase();
6        let breakers: Vec<&str> = path.split("\\").collect();
7        if !breakers[breakers.len() - 1].contains(exclude) {
8            new_paths.push(actual_path);
9        }
10    }
11    new_paths
12} 
13
14pub fn include_only_wanted_search_objects(paths: Vec<String>, include_only: &str) -> Vec<String> {
15    let mut new_paths: Vec<String> = Vec::new();
16    for mut path in paths {
17        let actual_path: String = path.clone();
18        path = path.to_lowercase();
19        let breakers: Vec<&str> = path.split("\\").collect();
20        if breakers[breakers.len() - 1].contains(include_only) {
21            new_paths.push(actual_path);
22        }
23    }
24    new_paths
25}
26
27pub(crate) fn print(paths: Vec<String>) {
28    println!("The paths are:");
29    for i in &paths {
30        println!("{}", i);
31    }
32    println!("Number of paths: {}", paths.len());
33}