Created
October 25, 2021 19:53
-
-
Save kkharji/4acfd339024edcc14d8b64a895543d0f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use ignore::{types::Types, Walk, WalkBuilder}; | |
fn get_results(home: &String, paths: &mut Vec<String>) -> Vec<String> { | |
let mut walker = WalkBuilder::new(paths.pop().unwrap()); | |
for root in paths { | |
walker.add(root); | |
} | |
let mut results = vec![]; | |
for result in walker.build() { | |
if let Ok(entry) = result { | |
let mut root = home; | |
let path = format!("{}", entry.path().display()); | |
for origin in special { | |
if path == format!("{}{}", origin, path.replace(origin, "")) { | |
root = origin; | |
break; | |
} | |
} | |
if Path::new(&path).is_file() { | |
results.push(parse::format_path(root, &path)); | |
} | |
} | |
} | |
results | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment