Simplify plugin directory scanning (#1910)

This commit is contained in:
Jonathan Turner 2020-05-29 07:14:32 +12:00 committed by GitHub
parent fe01a223a4
commit 3f9871f60d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,13 +110,19 @@ fn search_paths() -> Vec<std::path::PathBuf> {
}
}
#[cfg(not(debug_assertions))]
{
match env::var_os("PATH") {
Some(paths) => {
search_paths.extend(env::split_paths(&paths).collect::<Vec<_>>());
if let Ok(config) = crate::data::config::config(Tag::unknown()) {
if let Some(plugin_dirs) = config.get("plugin_dirs") {
if let Value {
value: UntaggedValue::Table(pipelines),
..
} = plugin_dirs
{
for pipeline in pipelines {
if let Ok(plugin_dir) = pipeline.as_string() {
search_paths.push(PathBuf::from(plugin_dir));
}
}
}
None => println!("PATH is not defined in the environment."),
}
}