Skip to content

Commit

Permalink
feat: use CARGO_BUILD_TARGET_DIR env
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
itkovian committed May 16, 2024
1 parent 332b9b8 commit 46782d6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion wezterm-gui/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::path::PathBuf;

fn main() {
println!("cargo:rerun-if-changed=build.rs");

Expand Down Expand Up @@ -168,7 +170,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_BUILD_TARGET_DIR")
.and_then(|s| Ok(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)
Expand Down

0 comments on commit 46782d6

Please sign in to comment.