Skip to content

Commit

Permalink
Remap CARGO_TARGET_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-mullvad committed Jan 18, 2025
1 parent 40fdaee commit 2fe3bf3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion remap-path-prefix/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ fn main() {
fn get_remap_path_prefix() -> Result<String, Box<dyn std::error::Error>> {
let cargo_home = home::cargo_home()?.display().to_string();
let rustup_home = home::rustup_home()?.display().to_string();
let cargo_target_dir = env!("CARGO_TARGET_DIR");

let source_dir = env!("CARGO_MANIFEST_DIR")
.split(concat!("/", env!("CARGO_PKG_NAME")))
.next()
.ok_or_else(|| "Could not find Cargo build dir.".to_string())?;

Ok(format!("--remap-path-prefix {cargo_home}=/CARGO_HOME --remap-path-prefix {rustup_home}=/RUSTUP_HOME --remap-path-prefix {source_dir}=/SOURCE_DIR"))
Ok(format!("--remap-path-prefix {cargo_target_dir}=/CARGO_TARGET_DIR --remap-path-prefix {cargo_home}=/CARGO_HOME --remap-path-prefix {rustup_home}=/RUSTUP_HOME --remap-path-prefix {source_dir}=/SOURCE_DIR"))
}

0 comments on commit 2fe3bf3

Please sign in to comment.