20 lines
608 B
Rust
20 lines
608 B
Rust
|
|
use std::path::PathBuf;
|
||
|
|
|
||
|
|
pub fn find<'a>(name: &'a str) -> impl Iterator<Item = PathBuf> + 'a {
|
||
|
|
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
|
||
|
|
})
|
||
|
|
})
|
||
|
|
}
|