How to remove absolute paths in release binary

Guys i'm trying to remove absolute paths in release binary on windows

i notice there is a topic just like my condition

but when i changed my rustflages in cargo.toml,there are still have this problems.

[build]
rustflags = ["--remap-path-prefix", "$HOME=~"] 
1 Like

It looks like --remap-path-prefix doesn’t work completely with the MSVC compiler: --remap-path-prefix has no effect · Issue #87805 · rust-lang/rust · GitHub

But it also looks like $HOME isn’t resolved in Cargo.toml and .cargo\config.toml. If I use the Windows GNU target and the command line

$env:RUSTFLAGS="--remap-path-prefix $HOME=~"

or put my home directory directly in .cargo\config.toml

[build]
rustflags = ["--remap-path-prefix", "C:\\Users\\evansc=~"]

then remap-path-prefix seems to work as expected.

thanks dude, finally i change my .cargo/config just like your config and it works :kissing_heart: