mirror of
https://github.com/nushell/nushell
synced 2024-12-29 06:23:11 +00:00
Simplify plugin directory scanning (#1910)
This commit is contained in:
parent
fe01a223a4
commit
3f9871f60d
1 changed files with 12 additions and 6 deletions
|
@ -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."),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue