From e31c8b4586cbc29b88cb5115c78de51b7576ede0 Mon Sep 17 00:00:00 2001 From: llama Date: Sat, 1 Nov 2025 22:42:29 +0800 Subject: [PATCH] add run_anki_normally --- qt/launcher/src/platform/mod.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/qt/launcher/src/platform/mod.rs b/qt/launcher/src/platform/mod.rs index 8ef786dca..6bff124be 100644 --- a/qt/launcher/src/platform/mod.rs +++ b/qt/launcher/src/platform/mod.rs @@ -113,6 +113,30 @@ pub fn launch_anki_normally(mut cmd: std::process::Command) -> Result<()> { Ok(()) } +pub fn _run_anki_normally(state: &crate::State) -> Result<()> { + #[cfg(windows)] + { + let console = std::env::var("ANKI_CONSOLE").is_ok(); + if console { + // no pythonw.exe available for us to use + ensure_terminal_shown()?; + } + crate::platform::windows::prepare_to_launch_normally(); + windows::run(state, console)?; + } + #[cfg(unix)] + nix::run(state)?; + Ok(()) +} + +pub fn run_anki_normally(state: &crate::State) -> bool { + if let Err(e) = _run_anki_normally(state) { + eprintln!("failed to run as embedded: {e:?}"); + return false; + } + true +} + #[cfg(windows)] pub use windows::ensure_terminal_shown;