diff --git a/fish-rust/src/env/environment.rs b/fish-rust/src/env/environment.rs index a5ea48225604..3e75cd0fa69f 100644 --- a/fish-rust/src/env/environment.rs +++ b/fish-rust/src/env/environment.rs @@ -512,7 +512,7 @@ fn setup_path() { str2wcstring(cstr.to_bytes()) } else { // the above should really not fail - L!("/usr/bin:/bin").to_owned() + join_strings(crate::path::DEFAULT_PATH.as_ref(), ':') }; vars.set_one(L!("PATH"), EnvMode::GLOBAL | EnvMode::EXPORT, path); diff --git a/fish-rust/src/path.rs b/fish-rust/src/path.rs index ce4a13828ce7..8f68946de204 100644 --- a/fish-rust/src/path.rs +++ b/fish-rust/src/path.rs @@ -185,7 +185,7 @@ pub fn path_get_path(cmd: &wstr, vars: &dyn Environment) -> Option { // PREFIX is defined at build time. #[widestrs] -static DEFAULT_PATH: Lazy<[WString; 3]> = Lazy::new(|| { +pub static DEFAULT_PATH: Lazy<[WString; 3]> = Lazy::new(|| { [ // TODO This should use env!. The fallback is only to appease "cargo test" for now. WString::from_str(option_env!("PREFIX").unwrap_or("/usr/local")) + "/bin"L, diff --git a/tests/checks/default-setup-path.fish b/tests/checks/default-setup-path.fish index c73edd54ff20..704617360114 100644 --- a/tests/checks/default-setup-path.fish +++ b/tests/checks/default-setup-path.fish @@ -5,8 +5,8 @@ if command -q getconf env -u PATH $fish -c 'test "$PATH" = "$('(command -s getconf)' PATH)"; and echo Success' else - # this is our DEFAULT_PATH + # this is DEFAULT_PATH # This techinically depends on PREFIX set in CMake - env -u PATH $fish -c 'test "$PATH" = "/usr/bin:/bin"; and echo Success' + env -u PATH $fish -c 'test "$PATH" = "/usr/local/bin:/usr/bin:/bin"; and echo Success' end # CHECK: Success