mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Re-use DEFAULT_PATH in setup_path
- No need to hard-code a different default
This commit is contained in:
parent
008764a2cd
commit
676c3c9bc2
3 changed files with 4 additions and 3 deletions
2
fish-rust/src/env/environment.rs
vendored
2
fish-rust/src/env/environment.rs
vendored
|
@ -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);
|
||||
|
|
|
@ -185,7 +185,7 @@ pub fn path_get_path(cmd: &wstr, vars: &dyn Environment) -> Option<WString> {
|
|||
|
||||
// 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,
|
||||
|
|
|
@ -6,6 +6,7 @@ if command -q getconf
|
|||
env -u PATH $fish -c 'test "$PATH" = "$('(command -s getconf)' PATH)"; and echo Success'
|
||||
else
|
||||
# this is DEFAULT_PATH
|
||||
env -u PATH $fish -c 'test "$PATH" = "/usr/bin:/bin"; and echo Success'
|
||||
# the first element (usually `/usr/local/bin`) depends on PREFIX set in CMake, so we ignore it
|
||||
env -u PATH $fish -c 'test "$PATH[2..]" = "/usr/bin:/bin"; and echo Success'
|
||||
end
|
||||
# CHECK: Success
|
||||
|
|
Loading…
Reference in a new issue