From 5be39c60cd04f534a1cd74e33afd2fcf57b13a79 Mon Sep 17 00:00:00 2001 From: NotTheDr01ds <32344964+NotTheDr01ds@users.noreply.github.com> Date: Mon, 20 Jan 2025 16:15:10 -0500 Subject: [PATCH] Use Nu config directory for user autoloads --- crates/nu-protocol/src/eval_const.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/crates/nu-protocol/src/eval_const.rs b/crates/nu-protocol/src/eval_const.rs index 42bf6b4de6190..b6506a7151af2 100644 --- a/crates/nu-protocol/src/eval_const.rs +++ b/crates/nu-protocol/src/eval_const.rs @@ -350,12 +350,6 @@ pub fn get_vendor_autoload_dirs(_engine_state: &EngineState) -> Vec { pub fn get_user_autoload_dirs(_engine_state: &EngineState) -> Vec { // User autoload directories - Currently just `autoload` in the default // configuration directory - let into_autoload_path_fn = |mut path: PathBuf| { - path.push("nushell"); - path.push("autoload"); - path - }; - let mut dirs = Vec::new(); let mut append_fn = |path: PathBuf| { @@ -364,8 +358,8 @@ pub fn get_user_autoload_dirs(_engine_state: &EngineState) -> Vec { } }; - if let Some(config_dir) = dirs::config_dir() { - append_fn(into_autoload_path_fn(config_dir)); + if let Some(config_dir) = nu_path::nu_config_dir() { + append_fn(config_dir.join("autoload").into()); } dirs