Make DEFAULT_PATH allow overriding system binaries

This is in regards to a comment on 290d07a833, which resulted in 46c967903d.
Those commits handled the default path when it is unset on startup.
DEFAULT_PATH is used when PATH is unset at runtime as far as I can tell.

As far as I can tell this has had the non-overidding ordering behavior since inception
(or at least 17 years ago ea998b03f2).
This commit is contained in:
Henrik Hørlück Berg 2023-08-20 17:56:47 +02:00 committed by Fabian Boehm
parent 3a4149a9e7
commit 008764a2cd

View file

@ -187,10 +187,10 @@ pub fn path_get_path(cmd: &wstr, vars: &dyn Environment) -> Option<WString> {
#[widestrs]
static DEFAULT_PATH: Lazy<[WString; 3]> = Lazy::new(|| {
[
"/bin"L.to_owned(),
"/usr/bin"L.to_owned(),
// 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,
"/usr/bin"L.to_owned(),
"/bin"L.to_owned(),
]
});