diff --git a/src/toolchain/gcc.rs b/src/toolchain/gcc.rs index c80a555..c1cca10 100644 --- a/src/toolchain/gcc.rs +++ b/src/toolchain/gcc.rs @@ -115,10 +115,13 @@ impl Installable for Gcc { #[cfg(windows)] if cfg!(windows) { - exports.push(format!("$Env:PATH += \";{}\"", &self.get_bin_path())); + exports.push(format!( + "$Env:PATH = \"{};\" + $Env:PATH", + &self.get_bin_path() + )); std::env::set_var( "PATH", - std::env::var("PATH").unwrap() + ";" + &self.get_bin_path().replace('/', "\\"), + self.get_bin_path().replace('/', "\\") + ";" + &std::env::var("PATH").unwrap(), ); } #[cfg(unix)] diff --git a/src/toolchain/llvm.rs b/src/toolchain/llvm.rs index 5e093eb..a54281d 100644 --- a/src/toolchain/llvm.rs +++ b/src/toolchain/llvm.rs @@ -153,7 +153,10 @@ impl Installable for Llvm { "$Env:LIBCLANG_PATH = \"{}/libclang.dll\"", self.get_lib_path() )); - exports.push(format!("$Env:PATH += \";{}\"", self.get_lib_path())); + exports.push(format!( + "$Env:PATH = \"{};\" + $Env:PATH", + self.get_lib_path() + )); Command::new("setx") .args([ "LIBCLANG_PATH", @@ -164,7 +167,7 @@ impl Installable for Llvm { .output()?; std::env::set_var( "PATH", - std::env::var("PATH").unwrap() + ";" + &self.get_lib_path().replace('/', "\\"), + self.get_lib_path().replace('/', "\\") + ";" + &std::env::var("PATH").unwrap(), ); } #[cfg(unix)]