diff --git a/locales/build.rs b/locales/build.rs index dfcfb1056..f7dcf5539 100644 --- a/locales/build.rs +++ b/locales/build.rs @@ -144,5 +144,5 @@ fn main() { } fn project_root() -> PathBuf { - Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(1).unwrap().to_path_buf() + Path::new(&std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set — this binary must be run via cargo")).ancestors().nth(1).unwrap().to_path_buf() } diff --git a/xtask/src/builder.rs b/xtask/src/builder.rs index 78b17fc82..f68792747 100644 --- a/xtask/src/builder.rs +++ b/xtask/src/builder.rs @@ -1524,7 +1524,7 @@ pub fn cargo(configs: &[String]) -> Command { } pub fn project_root() -> PathBuf { - Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(1).unwrap().to_path_buf() + Path::new(&std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set — this binary must be run via cargo")).ancestors().nth(1).unwrap().to_path_buf() } use std::fs::File;