Merge pull request #834 from sbellem/cargo-manifest-dir

fix: use runtime CARGO_MANIFEST_DIR
This commit is contained in:
bunnie 2026-03-18 11:05:39 +08:00 committed by GitHub
commit e548696757
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -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()
}

View file

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