[yabridgectl] Rewrite the blacklist check

This commit is contained in:
Robbert van der Helm
2022-01-07 19:15:23 +01:00
parent 263b192daa
commit ed4a39375f
+4 -5
View File
@@ -351,11 +351,10 @@ pub fn index(directory: &Path, blacklist: &HashSet<&Path>) -> SearchIndex {
.filter_entry(|e| {
// The blacklist entries are canonicalized to resolve symlinks and to normalize slashes,
// so we should do the same thing here as well
if let Ok(p) = e.path().canonicalize() {
!blacklist.contains(p.as_path())
} else {
true
}
e.path()
.canonicalize()
.map(|p| !blacklist.contains(p.as_path()))
.unwrap_or(false)
})
.filter_map(|e| e.ok())
.filter(|e| !e.file_type().is_dir())