add is_library_available command
This commit is contained in:
parent
622f4118c0
commit
1eb49350e9
@ -56,9 +56,9 @@ serde_yaml = "0.9.34"
|
||||
hmac = "0.12.1"
|
||||
sha2 = "0.10.9"
|
||||
base64 = "0.22.1"
|
||||
libloading = "0.8.7"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
libloading = "0.8.7"
|
||||
libc = "0.2.172"
|
||||
|
||||
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
|
||||
|
||||
@ -151,3 +151,15 @@ pub fn decompress(app: tauri::AppHandle, path: &str, output_dir: &str) -> Result
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// check if a system library is available
|
||||
#[tauri::command]
|
||||
pub fn is_library_available(library: &str) -> bool {
|
||||
match unsafe { libloading::Library::new(library) } {
|
||||
Ok(_) => true,
|
||||
Err(e) => {
|
||||
log::info!("Library {} is not available: {}", library, e);
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,6 +83,7 @@ pub fn run() {
|
||||
core::utils::write_yaml,
|
||||
core::utils::read_yaml,
|
||||
core::utils::decompress,
|
||||
core::utils::is_library_available,
|
||||
// Download
|
||||
core::utils::download::download_files,
|
||||
core::utils::download::cancel_download_task,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user