Remove redundant fallbacks for installation dir variables

They are redundant as of a5e35abeb (build.rs: Default variables, 2024-01-15).
This commit is contained in:
Johannes Altmanninger 2024-01-20 09:34:01 +01:00
parent e73d7e26e4
commit f356e2d82f
3 changed files with 6 additions and 30 deletions

View File

@ -72,34 +72,11 @@ use std::path::{Path, PathBuf};
use std::sync::atomic::Ordering;
use std::sync::Arc;
// FIXME: the following should just use env!(), this is to make `cargo test` work without CMake for now
const DOC_DIR: &str = {
match option_env!("DOCDIR") {
Some(e) => e,
None => "(unused)",
}
};
const DATA_DIR: &str = {
match option_env!("DATADIR") {
Some(e) => e,
None => "(unused)",
}
};
const SYSCONF_DIR: &str = {
match option_env!("SYSCONFDIR") {
Some(e) => e,
None => "(unused)",
}
};
const BIN_DIR: &str = {
match option_env!("BINDIR") {
Some(e) => e,
None => "(unused)",
}
};
const DOC_DIR: &str = env!("DOCDIR");
const DATA_DIR: &str = env!("DATADIR");
const SYSCONF_DIR: &str = env!("SYSCONFDIR");
const BIN_DIR: &str = env!("BINDIR");
// C++ had this as optional, and used CMAKE_BINARY_DIR,
// should probably be swapped to `OUT_DIR` once CMake is gone?
const OUT_DIR: &str = env!("FISH_BUILD_DIR");
/// container to hold the options specified within the command line

View File

@ -184,8 +184,7 @@ pub fn path_get_path(cmd: &wstr, vars: &dyn Environment) -> Option<WString> {
// PREFIX is defined at build time.
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")) + L!("/bin"),
WString::from_str(env!("PREFIX")) + L!("/bin"),
L!("/usr/bin").to_owned(),
L!("/bin").to_owned(),
]

View File

@ -48,7 +48,7 @@ use internal::*;
// Really init wgettext.
fn wgettext_really_init() {
let package_name = CString::new(PACKAGE_NAME).unwrap();
let localedir = CString::new(option_env!("LOCALEDIR").unwrap_or("UNDEFINED")).unwrap();
let localedir = CString::new(env!("LOCALEDIR")).unwrap();
fish_bindtextdomain(&package_name, &localedir);
fish_textdomain(&package_name);
}