fix: handle PATH the right way and fix .build.env example for windows

This commit is contained in:
Florian Briand 2024-07-06 18:43:09 +02:00
parent c462442221
commit 571da52888
2 changed files with 3 additions and 4 deletions

View File

@ -1,3 +1,3 @@
SESAM_FSV_VERSION=1.40.13 SESAM_FSV_VERSION=1.40.13
SESAM_FSV_LIB_PATH=C:/Program Files/santesocial/fsv/${SESAM_FSV_VERSION}/lib SESAM_FSV_LIB_PATH="C:/Program Files/santesocial/fsv/${SESAM_FSV_VERSION}/lib"
SESAM_FSV_SSVLIB=ssvw64 SESAM_FSV_SSVLIB=ssvw64

View File

@ -5,6 +5,7 @@ use std::path::PathBuf;
fn main() { fn main() {
dotenv::from_filename(".env.build").ok(); dotenv::from_filename(".env.build").ok();
println!("cargo::rerun-if-changed=.env.build");
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
@ -17,10 +18,8 @@ fn main() {
println!("cargo::rustc-link-lib=dylib={}", env::var("SESAM_FSV_SSVLIB").unwrap()); println!("cargo::rustc-link-lib=dylib={}", env::var("SESAM_FSV_SSVLIB").unwrap());
if cfg!(target_os = "windows") { if cfg!(target_os = "windows") {
// Get PATH value
let path = env::var("PATH").unwrap_or(String::new()); let path = env::var("PATH").unwrap_or(String::new());
println!("PATH={}", path); println!("cargo:rustc-env=PATH={};{}", fsv_lib_path.display(), path);
println!("cargo:rustc-env=PATH={}", fsv_lib_path.display());
} else if cfg!(target_os = "linux") { } else if cfg!(target_os = "linux") {
println!("cargo:rustc-env=LD_LIBRARY_PATH={}", fsv_lib_path.display()); println!("cargo:rustc-env=LD_LIBRARY_PATH={}", fsv_lib_path.display());
} }