fix: make path to env files depend of the CARGO_MANIFEST_DIR of sesam-vitale crate
This commit is contained in:
parent
a194b2d888
commit
9fc3fef350
@ -5,13 +5,17 @@ use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
// Load the .env.build file for build-time environment variables
|
||||
dotenv::from_filename(".env.build").ok();
|
||||
println!("cargo::rerun-if-changed=.env.build");
|
||||
|
||||
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
let manifest_path = PathBuf::from(manifest_dir);
|
||||
dotenv::from_path(manifest_path.join(".env.build")).ok();
|
||||
|
||||
println!("cargo::rerun-if-env-changed=SESAM_FSV_LIB_PATH");
|
||||
println!("cargo::rerun-if-env-changed=SESAM_FSV_SSVLIB");
|
||||
println!("cargo::rerun-if-changed=.env.build");
|
||||
println!("cargo::rerun-if-changed=build.rs");
|
||||
|
||||
// Add local lib directory to the linker search path (for def files and static libs)
|
||||
let static_lib_path = PathBuf::from(manifest_dir).join("lib");
|
||||
let static_lib_path = manifest_path.join("lib");
|
||||
println!("cargo::rustc-link-search=native={}", static_lib_path.display());
|
||||
|
||||
// Add the SESAM_FSV_LIB_PATH to the linker search path
|
||||
|
@ -3,9 +3,9 @@ extern crate dotenv;
|
||||
|
||||
use libc::{ c_char, c_void, c_ushort, size_t };
|
||||
use std::ffi::CString;
|
||||
use std::path::PathBuf;
|
||||
use std::ptr;
|
||||
|
||||
use dotenv::dotenv;
|
||||
use std::env;
|
||||
|
||||
extern "C" {
|
||||
@ -72,7 +72,9 @@ fn ssv_lire_config() {
|
||||
}
|
||||
|
||||
pub fn demo() {
|
||||
dotenv().ok();
|
||||
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
let manifest_path = PathBuf::from(manifest_dir);
|
||||
dotenv::from_path(manifest_path.join(".env")).ok();
|
||||
|
||||
println!("------- Demo for the SSV library --------");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user