Launcher now checks Windows version

https://forums.ankiweb.net/t/issue-with-installing-anki-launcher-into-custom-folder/66355
This commit is contained in:
Damien Elmes 2025-09-23 19:50:19 +10:00
parent 99c67d39cb
commit 04a0b10a15
2 changed files with 23 additions and 0 deletions

View file

@ -134,5 +134,8 @@ pub fn ensure_os_supported() -> Result<()> {
#[cfg(all(unix, not(target_os = "macos")))]
unix::ensure_glibc_supported()?;
#[cfg(target_os = "windows")]
windows::ensure_windows_version_supported()?;
Ok(())
}

View file

@ -38,6 +38,26 @@ fn is_windows_10() -> bool {
}
}
/// Ensures Windows 10 version 1809 or later
pub fn ensure_windows_version_supported() -> Result<()> {
unsafe {
let mut info = OSVERSIONINFOW {
dwOSVersionInfoSize: std::mem::size_of::<OSVERSIONINFOW>() as u32,
..Default::default()
};
if RtlGetVersion(&mut info).is_err() {
anyhow::bail!("Failed to get Windows version information");
}
if info.dwBuildNumber >= 17763 {
return Ok(());
}
anyhow::bail!("Windows 10 version 1809 or later is required.")
}
}
pub fn ensure_terminal_shown() -> Result<()> {
unsafe {
if !GetConsoleWindow().is_invalid() {