From f792bf606bb237bd1c3a06f403cbaa90bdeac634 Mon Sep 17 00:00:00 2001 From: Tlntin Date: Sat, 10 Dec 2022 19:49:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B2=BE=E7=AE=80Linux/Windows=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/src/main.rs | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index bcb451c..da8b6b8 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -62,25 +62,29 @@ fn main() -> wry::Result<()> { #[cfg(target_os = "macos")] first_menu.add_native_item(MenuItem::Quit); - #[cfg(target_os = "macos")] menu_bar_menu.add_submenu("App", true, first_menu); - #[cfg(any(target_os = "linux", target_os = "windows"))] - let (package_name, windows_config) = get_windows_config(); - #[cfg(any(target_os = "linux", target_os = "windows"))] - let package_name = package_name - .expect("can't get package name in config file") - .to_lowercase(); #[cfg(any(target_os = "linux", target_os = "windows"))] - let WindowConfig { - url, - width, - height, - resizable, - fullscreen, - .. - } = windows_config.unwrap_or_default(); + let ( + package_name, + WindowConfig { + url, + width, + height, + resizable, + fullscreen, + .. + }, + ) = { + let (package_name, windows_config) = get_windows_config(); + ( + package_name + .expect("can't get package name in config file") + .to_lowercase(), + windows_config.unwrap_or_default(), + ) + }; #[cfg(target_os = "macos")] let WindowConfig {