Check for the presence of CARGO_BUILD_TARGET_DIR env variable (#5430)

* feat: use CARGO_BUILD_TARGET_DIR env

When building in the presence of a CARGO_BUILD_TARGET_DIR, there is no
target dir created inside the repo, so copying to a location within the
local repo dir fails, hence we need to copy to the actual target dir
that is being used.

* fix: environment variable with correct name
This commit is contained in:
Andy Georges authored and GitHub committed 2024-06-17 08:25:57 -07:00
1 parent 1d3a459ca8
commit 17958dbbec
1 file changed
+4 -1
+4 -1
View File
@@ -168,7 +168,10 @@ END
.join("WezTerm.app")
.join("Contents")
.join("Info.plist");
let dest_plist = repo_dir.join("target").join(profile).join("Info.plist");
let build_target_dir = std::env::var("CARGO_TARGET_DIR")
.and_then(|s| Ok(std::path::PathBuf::from(s)))
.unwrap_or(repo_dir.join("target").join(profile));
let dest_plist = build_target_dir.join("Info.plist");
println!("cargo:rerun-if-changed=assets/macos/WezTerm.app/Contents/Info.plist");
std::fs::copy(&src_plist, &dest_plist)