diff --git a/crates/fsv-sys/src/lib.rs b/crates/fsv-sys/src/lib.rs index 05cd3bf..ace27ae 100644 --- a/crates/fsv-sys/src/lib.rs +++ b/crates/fsv-sys/src/lib.rs @@ -4,7 +4,7 @@ use std::marker::PhantomData; -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum SUPPORTED_FSV_VERSIONS { V1_40_14, // 1.40.14 V1_40_13, // 1.40.13 @@ -19,11 +19,11 @@ impl SUPPORTED_FSV_VERSIONS { } } -pub mod BINDINGS_V1_40_14 { +mod BINDINGS_V1_40_14 { include!(concat!(env!("OUT_DIR"), "/bindings_1.40.14.rs")); } -pub mod BINDINGS_V1_40_13 { +mod BINDINGS_V1_40_13 { include!(concat!(env!("OUT_DIR"), "/bindings_1.40.13.rs")); } @@ -137,14 +137,14 @@ impl SSVLibrary { }); } -pub fn get_library_path(version: SUPPORTED_FSV_VERSIONS) -> String { +pub fn get_library_path(version: &SUPPORTED_FSV_VERSIONS) -> String { let root_path = get_library_root_path(); let library_name = get_library_name(); let version = version.as_str(); format!("{root_path}/{version}/lib/{library_name}") } -pub fn sesam_ini_path(version: SUPPORTED_FSV_VERSIONS) -> String { +pub fn sesam_ini_path(version: &SUPPORTED_FSV_VERSIONS) -> String { let root_path = get_sesam_ini_root_path(); let version = version.as_str(); format!("{root_path}/{version}/conf/sesam.ini") @@ -171,22 +171,22 @@ mod test { #[test] fn test_initlib2() { - let lib_path = &get_library_path(SUPPORTED_FSV_VERSIONS::V1_40_13); + let lib_path = &get_library_path(&SUPPORTED_FSV_VERSIONS::V1_40_13); let ssv_library = SSVLibrary::::new(lib_path).expect("SSVLibrary::new failed"); let sesam_ini_str = - CString::new(sesam_ini_path(SUPPORTED_FSV_VERSIONS::V1_40_13)).expect("CString::new failed"); + CString::new(sesam_ini_path(&SUPPORTED_FSV_VERSIONS::V1_40_13)).expect("CString::new failed"); let result = unsafe { ssv_library.ssv_init_lib2(sesam_ini_str.as_ptr()) }.unwrap(); assert_eq!(result, 0); } #[test] fn test_lire_config_and_carte_ps() { - let lib_path = &get_library_path(SUPPORTED_FSV_VERSIONS::V1_40_13); + let lib_path = &get_library_path(&SUPPORTED_FSV_VERSIONS::V1_40_13); let ssv_library = SSVLibrary::::new(lib_path).expect("SSVLibrary::new failed"); let sesam_ini_str = - CString::new(sesam_ini_path(SUPPORTED_FSV_VERSIONS::V1_40_13)).expect("CString::new failed"); + CString::new(sesam_ini_path(&SUPPORTED_FSV_VERSIONS::V1_40_13)).expect("CString::new failed"); let result = unsafe { ssv_library.ssv_init_lib2(sesam_ini_str.as_ptr()) }.unwrap(); assert_eq!(result, 0);