From 62c5df5fc646a32d5efebb3e6793e8e3157b151d Mon Sep 17 00:00:00 2001 From: hedonihilist Date: Sat, 2 Oct 2021 16:38:21 +0800 Subject: [PATCH] expand tilde when reading plugin_dirs (#4052) --- Cargo.lock | 1 + crates/nu-cli/Cargo.toml | 1 + crates/nu-cli/src/cli.rs | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 226e691222..6c4dea2fd8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2566,6 +2566,7 @@ dependencies = [ "nu-engine", "nu-errors", "nu-parser", + "nu-path", "nu-protocol", "nu-source", "nu-stream", diff --git a/crates/nu-cli/Cargo.toml b/crates/nu-cli/Cargo.toml index b4c039b061..4f9ad91e2c 100644 --- a/crates/nu-cli/Cargo.toml +++ b/crates/nu-cli/Cargo.toml @@ -21,6 +21,7 @@ nu-protocol = { version = "0.37.1", path="../nu-protocol" } nu-source = { version = "0.37.1", path="../nu-source" } nu-stream = { version = "0.37.1", path="../nu-stream" } nu-ansi-term = { version = "0.37.1", path="../nu-ansi-term" } +nu-path = { version = "0.37.1", path="../nu-path" } indexmap ="1.6.1" log = "0.4.14" diff --git a/crates/nu-cli/src/cli.rs b/crates/nu-cli/src/cli.rs index 78a69cd385..59d5fa4e09 100644 --- a/crates/nu-cli/src/cli.rs +++ b/crates/nu-cli/src/cli.rs @@ -24,6 +24,7 @@ use rustyline::{self, error::ReadlineError}; use nu_errors::ShellError; use nu_parser::ParserScope; +use nu_path::expand_tilde; use nu_protocol::{hir::ExternalRedirection, ConfigPath, UntaggedValue, Value}; use log::trace; @@ -54,7 +55,7 @@ pub fn search_paths() -> Vec { { for pipeline in pipelines { if let Ok(plugin_dir) = pipeline.as_string() { - search_paths.push(PathBuf::from(plugin_dir)); + search_paths.push(expand_tilde(plugin_dir)); } } }