Skip to content

Commit a59efd8

Browse files
author
Allen Hsu
committed
Use OUT_DIR over CARGO_TARGET_DIR.
- rust-lang/cargo#9661 (comment) CARGO_TARGET_DIR from cargo.toml is not available during build scripts at the moment
1 parent 23d643b commit a59efd8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

wezterm-gui/build.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,14 @@ END
168168
.join("WezTerm.app")
169169
.join("Contents")
170170
.join("Info.plist");
171-
let build_target_dir = std::env::var("CARGO_TARGET_DIR")
172-
.and_then(|s| Ok(std::path::PathBuf::from(s)))
171+
let build_target_dir = std::env::var("OUT_DIR")
172+
.map(|s| {
173+
let mut path = std::path::PathBuf::from(s);
174+
// OUT_DIR form is:
175+
// $CARGO_TARGET_DIR/target/{profile}/build/wezterm-gui-<unique_build_path>/out
176+
for _ in 0..3 { path.pop(); } // drop /build/wezterm-gui-<unique_build_path>/out
177+
path
178+
})
173179
.unwrap_or(repo_dir.join("target").join(profile));
174180
let dest_plist = build_target_dir.join("Info.plist");
175181
println!("cargo:rerun-if-changed=assets/macos/WezTerm.app/Contents/Info.plist");

0 commit comments

Comments
 (0)