launch anki embeddedly(?), fallback to usual launch

This commit is contained in:
llama 2025-11-01 22:42:46 +08:00
parent e31c8b4586
commit c22e38f4a8
No known key found for this signature in database
GPG key ID: 0B7543854B9413C3

View file

@ -28,6 +28,7 @@ use crate::platform::get_exe_and_resources_dirs;
use crate::platform::get_uv_binary_name; use crate::platform::get_uv_binary_name;
use crate::platform::launch_anki_normally; use crate::platform::launch_anki_normally;
use crate::platform::respawn_launcher; use crate::platform::respawn_launcher;
use crate::platform::run_anki_normally;
mod platform; mod platform;
@ -158,9 +159,11 @@ fn run() -> Result<()> {
if !launcher_requested && !pyproject_has_changed && !different_launcher { if !launcher_requested && !pyproject_has_changed && !different_launcher {
// If no launcher request and venv is already up to date, launch Anki normally // If no launcher request and venv is already up to date, launch Anki normally
let args: Vec<String> = std::env::args().skip(1).collect(); if std::env::var("ANKI_LAUNCHER_NO_EMBED").is_ok() || !run_anki_normally(&state) {
let cmd = build_python_command(&state, &args)?; let args: Vec<String> = std::env::args().skip(1).collect();
launch_anki_normally(cmd)?; let cmd = build_python_command(&state, &args)?;
launch_anki_normally(cmd)?;
}
return Ok(()); return Ok(());
} }