mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 12:47:11 -05:00
add run_anki_normally
This commit is contained in:
parent
de531e07ab
commit
e31c8b4586
1 changed files with 24 additions and 0 deletions
|
|
@ -113,6 +113,30 @@ pub fn launch_anki_normally(mut cmd: std::process::Command) -> Result<()> {
|
||||||
Ok(())
|
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)]
|
#[cfg(windows)]
|
||||||
pub use windows::ensure_terminal_shown;
|
pub use windows::ensure_terminal_shown;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue