diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index c97fcd5..f317b04 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -25,8 +25,7 @@ tauri-plugin-fs = "2.4.5" zip = "8.4.0" tauri-plugin-dialog = "2.6.0" tauri-plugin-notification = "2.3.3" -sysinfo = "0.38.4" -sha2 = "0.10.9" +sha2 = "0.11.0" tauri-plugin-clipboard-manager = "2.3.2" tauri-plugin-prevent-default = "4.0.4" openssl = { version = "0.10.76", features = ["v110", "vendored"] } @@ -35,9 +34,18 @@ tauri-plugin-http = "2.5.7" dashmap = "6.1.0" tauri-plugin-store = "2.4.2" +[target.'cfg(any(target_os = "windows", target_os = "linux"))'.dependencies] +sysinfo = "0.38.4" + [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] tauri-plugin-single-instance = "2.4.0" tauri-plugin-window-state = "2.4.1" [target.'cfg(target_os = "windows")'.dependencies] tauri-plugin-decorum = "1.1.1" + +[profile.release] +opt-level = 3 +lto = true +codegen-units = 1 +strip = true diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index b7d038d..039a0e1 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -15,7 +15,6 @@ use std::{ process::Command, time::Duration, }; -use sysinfo::System; use tauri::window::{ProgressBarState, ProgressBarStatus}; use tauri::{AppHandle, Emitter, Manager}; use tauri_plugin_os::platform; @@ -25,6 +24,9 @@ use tokio::{io::AsyncWriteExt, time::timeout}; use zip::ZipArchive; use zip::result::ZipError; +#[cfg(any(target_os = "windows", target_os = "linux"))] +use sysinfo::System; + #[cfg(unix)] use std::os::unix::fs::PermissionsExt; @@ -38,6 +40,7 @@ fn is_cancelled(name: &str) -> bool { cancel_map().get(name).map(|v| *v).unwrap_or(false) } +#[cfg(any(target_os = "windows", target_os = "linux"))] fn is_running_by_path(path: &Path) -> bool { let sys = System::new_all(); let target = match path.canonicalize() {