diff --git a/src/bin/fish.rs b/src/bin/fish.rs index 0b613f11c..a66ca9950 100644 --- a/src/bin/fish.rs +++ b/src/bin/fish.rs @@ -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 diff --git a/src/path.rs b/src/path.rs index 6b2cc6f26..e28bb813b 100644 --- a/src/path.rs +++ b/src/path.rs @@ -184,8 +184,7 @@ pub fn path_get_path(cmd: &wstr, vars: &dyn Environment) -> Option { // 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(), ] diff --git a/src/wutil/gettext.rs b/src/wutil/gettext.rs index c4716a89d..b537ee42f 100644 --- a/src/wutil/gettext.rs +++ b/src/wutil/gettext.rs @@ -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); }