Re-use DEFAULT_PATH in setup_path

- No need to hard-code a different default
This commit is contained in:
Henrik Hørlück Berg
2023-08-20 16:08:54 +02:00
committed by Fabian Boehm
parent 008764a2cd
commit 676c3c9bc2
3 changed files with 4 additions and 3 deletions

View File

@@ -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);

View File

@@ -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,