mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 00:36:38 -04:00
Launcher now checks Windows version
https://forums.ankiweb.net/t/issue-with-installing-anki-launcher-into-custom-folder/66355
This commit is contained in:
parent
99c67d39cb
commit
04a0b10a15
2 changed files with 23 additions and 0 deletions
|
@ -134,5 +134,8 @@ pub fn ensure_os_supported() -> Result<()> {
|
||||||
#[cfg(all(unix, not(target_os = "macos")))]
|
#[cfg(all(unix, not(target_os = "macos")))]
|
||||||
unix::ensure_glibc_supported()?;
|
unix::ensure_glibc_supported()?;
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
windows::ensure_windows_version_supported()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -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<()> {
|
pub fn ensure_terminal_shown() -> Result<()> {
|
||||||
unsafe {
|
unsafe {
|
||||||
if !GetConsoleWindow().is_invalid() {
|
if !GetConsoleWindow().is_invalid() {
|
||||||
|
|
Loading…
Reference in a new issue