Merge #2152
2152: Use run-time project path in xtask r=matklad a=lnicola Fixes #2131. Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
This commit is contained in:
commit
eb8f76a86f
@ -3,6 +3,7 @@
|
||||
pub mod codegen;
|
||||
|
||||
use std::{
|
||||
env,
|
||||
error::Error,
|
||||
fs,
|
||||
io::{Error as IoError, ErrorKind},
|
||||
@ -17,7 +18,13 @@
|
||||
const TOOLCHAIN: &str = "stable";
|
||||
|
||||
pub fn project_root() -> PathBuf {
|
||||
Path::new(&env!("CARGO_MANIFEST_DIR")).ancestors().nth(1).unwrap().to_path_buf()
|
||||
Path::new(
|
||||
&env::var("CARGO_MANIFEST_DIR").unwrap_or_else(|_| env!("CARGO_MANIFEST_DIR").to_owned()),
|
||||
)
|
||||
.ancestors()
|
||||
.nth(1)
|
||||
.unwrap()
|
||||
.to_path_buf()
|
||||
}
|
||||
|
||||
pub struct Cmd<'a> {
|
||||
|
Loading…
Reference in New Issue
Block a user