fix: make sesam-vitale build works even when having a lib.rs file
This commit is contained in:
@ -1,18 +1,24 @@
|
||||
/**
|
||||
* High level API for the SSV library,
|
||||
* based on the low level bindings in libssv.rs.
|
||||
*
|
||||
*/
|
||||
|
||||
extern crate libc;
|
||||
extern crate dotenv;
|
||||
|
||||
use libc::{ c_char, c_void, c_ushort, size_t };
|
||||
use libc::{ c_void, size_t };
|
||||
use std::ffi::CString;
|
||||
use std::path::PathBuf;
|
||||
use std::ptr;
|
||||
|
||||
use std::env;
|
||||
|
||||
extern "C" {
|
||||
fn SSV_InitLIB2(pcRepSesamIni: *const c_char) -> c_ushort;
|
||||
fn SSV_LireCartePS(NomRessourcePS: *const c_char, NomRessourceLecteur: *const c_char, CodePorteurPS: *const c_char, ZDonneesSortie: *mut *mut c_void, TTailleDonneesSortie: *mut size_t) -> c_ushort;
|
||||
fn SSV_LireConfig(ZDonneesSortie: *mut *mut c_void, TTailleDonneesSortie: *mut size_t) -> c_ushort;
|
||||
}
|
||||
use crate::libssv:: {
|
||||
SSV_InitLIB2,
|
||||
SSV_LireCartePS,
|
||||
SSV_LireConfig
|
||||
};
|
||||
|
||||
fn ssv_init_lib_2() {
|
||||
let ini_str = env::var("SESAM_INI_PATH").expect("SESAM_INI_PATH must be set");
|
||||
@ -72,6 +78,10 @@ fn ssv_lire_config() {
|
||||
}
|
||||
|
||||
pub fn demo() {
|
||||
/*
|
||||
* TODO : this is probably not working on release, because I'm not sure it exists a CARGO_MANIFEST_DIR and so it can find the `.env`
|
||||
* Maybe we could use a system standard config path to store a config file
|
||||
*/
|
||||
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
let manifest_path = PathBuf::from(manifest_dir);
|
||||
dotenv::from_path(manifest_path.join(".env")).ok();
|
||||
|
Reference in New Issue
Block a user