refractor: add missing MacOS depencies for tauri application

This commit is contained in:
2026-03-25 07:11:37 +01:00
parent b4b3494e17
commit 778a3fc258
7 changed files with 66 additions and 13 deletions

View File

@@ -996,8 +996,17 @@ pub fn run() {
Ok(())
})
.on_window_event(|window, event| match event {
WindowEvent::CloseRequested { .. } => {
window.app_handle().exit(0);
WindowEvent::CloseRequested { api, .. } => {
#[cfg(target_os = "macos")]
{
hide_main_window(window);
api.prevent_close();
}
#[cfg(not(target_os = "macos"))]
{
let _ = api;
window.app_handle().exit(0);
}
}
WindowEvent::Resized(_) => {
if window.is_minimized().unwrap_or(false) {

View File

@@ -15,8 +15,10 @@ const CREATE_NO_WINDOW: u32 = 0x08000000;
pub fn current_tunnel_strategy() -> &'static str {
if cfg!(target_os = "windows") {
"embedded-wireguard-windows-x64"
} else if cfg!(target_os = "macos") {
"embedded-wireguard-macos-arm"
} else if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
"embedded-wireguard-macos-arm64"
} else if cfg!(all(target_os = "macos", target_arch = "x86_64")) {
"embedded-wireguard-macos-x64"
} else {
"unsupported"
}
@@ -108,10 +110,12 @@ fn bundled_backend(app: &AppHandle) -> Result<PathBuf, String> {
let relative = if cfg!(target_os = "windows") {
PathBuf::from("bundled/windows-x64/nexavpn-tunnel-helper.exe")
} else if cfg!(target_os = "macos") {
} else if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
PathBuf::from("bundled/macos-arm64/nexavpn-tunnel-helper")
} else if cfg!(all(target_os = "macos", target_arch = "x86_64")) {
PathBuf::from("bundled/macos-x64/nexavpn-tunnel-helper")
} else {
return Err("This NexaVPN client build supports embedded tunnel backends only for Windows x64 and macOS ARM".into());
return Err("This NexaVPN client build supports embedded tunnel backends only for Windows x64, macOS ARM64, and macOS x64".into());
};
let path = resource_dir.join(relative);