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:
bors[bot] 2019-11-01 20:25:17 +00:00 committed by GitHub
commit eb8f76a86f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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