From 030f6d58fb2b699861f327d8e05543fe0a0097d9 Mon Sep 17 00:00:00 2001 From: CGQAQ Date: Fri, 10 Jun 2022 06:04:54 +0800 Subject: [PATCH] conditional devtools --- packages/desktop/Cargo.toml | 2 +- packages/desktop/src/desktop_context.rs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/desktop/Cargo.toml b/packages/desktop/Cargo.toml index 8c3317843..e61120d64 100644 --- a/packages/desktop/Cargo.toml +++ b/packages/desktop/Cargo.toml @@ -20,7 +20,7 @@ serde = "1.0.136" serde_json = "1.0.79" thiserror = "1.0.30" log = "0.4.14" -wry = { version = "0.16.0", features = ["devtools"] } +wry = { version = "0.16.0" } futures-channel = "0.3.21" tokio = { version = "1.16.1", features = [ "sync", diff --git a/packages/desktop/src/desktop_context.rs b/packages/desktop/src/desktop_context.rs index 3d4bf0b26..d6d436a09 100644 --- a/packages/desktop/src/desktop_context.rs +++ b/packages/desktop/src/desktop_context.rs @@ -212,7 +212,12 @@ pub(super) fn handler( log::warn!("Open print modal failed: {e}"); } } - DevTool => webview.open_devtools(), + DevTool => { + #[cfg(debug_assertions)] + webview.open_devtools(); + #[cfg(not(debug_assertions))] + log::warn!("Devtools are disabled in release builds"); + } Eval(code) => { if let Err(e) = webview.evaluate_script(code.as_str()) {