diff --git a/wezterm-gui/build.rs b/wezterm-gui/build.rs index 7ef7b98779b9..4cf13ef24148 100644 --- a/wezterm-gui/build.rs +++ b/wezterm-gui/build.rs @@ -1,3 +1,5 @@ +use std::path::PathBuf; + fn main() { println!("cargo:rerun-if-changed=build.rs"); @@ -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)