Respect CARGO_TARGET_DIR when set (#1528)

This makes the `binaries` function respect the `CARGO_TARGET_DIR` environment variable when set. If it's not present it falls back to the regular target directory used by Cargo.
This commit is contained in:
Jon Grythe Stødle 2020-03-27 22:13:59 +01:00 committed by GitHub
parent 06f87cfbe8
commit a5e97ca549
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -246,7 +246,10 @@ pub fn root() -> PathBuf {
}
pub fn binaries() -> PathBuf {
root().join("target/debug")
std::env::var("CARGO_TARGET_DIR")
.ok()
.map(|target_dir| PathBuf::from(target_dir).join("debug"))
.unwrap_or_else(|| root().join("target/debug"))
}
pub fn fixtures() -> PathBuf {