2021-08-15 13:21:28 +02:00
|
|
|
use std::path::PathBuf;
|
|
|
|
|
|
2021-08-16 13:27:18 +02:00
|
|
|
pub fn find(name: &'_ str) -> impl Iterator<Item = PathBuf> + '_ {
|
2021-08-15 13:21:28 +02:00
|
|
|
crate::plugin_paths()
|
|
|
|
|
.filter_map(|path| path.read_dir().ok())
|
|
|
|
|
.flat_map(move |dir| {
|
|
|
|
|
dir.filter_map(Result::ok).filter_map(move |entry| {
|
|
|
|
|
if entry.file_name() == name {
|
|
|
|
|
let path = entry.path();
|
|
|
|
|
let config_path = path.join("config.ron");
|
|
|
|
|
if config_path.exists() {
|
|
|
|
|
return Some(config_path);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
None
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|