From 7599dbc2090466ecac8c75ac5c36ec9ffbd882b2 Mon Sep 17 00:00:00 2001 From: bitraid Date: Sun, 13 Aug 2023 12:38:19 +1200 Subject: nsis: custom error message for Qt5 OS version check The CheckPlatform macro will prompt the user user to use the 32bit installer if they are on a 32bit system. But we don't provide a 32bit installer anymore. This commit changes the OS version check for Qt5 builds to be based on checking version numbers ourselves too, so that we can have our own error message. Also moves the Qt5 conditionals to be compile time ones. --- misc/nsis/install.nsh | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/misc/nsis/install.nsh b/misc/nsis/install.nsh index dffe707c5..282a254eb 100755 --- a/misc/nsis/install.nsh +++ b/misc/nsis/install.nsh @@ -432,24 +432,32 @@ Function .onInit StrCpy $KeepReg 1 ; OS version check - ${If} ${QT5} == "True" - !insertmacro CheckPlatform ${PLATFORM} - !insertmacro CheckMinWinVer ${MIN_WIN_VER} - Goto _os_check_pass - ${ElseIf} ${RunningX64} + ${If} ${RunningX64} + ; https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-osversioninfoa#remarks GetWinVer $R0 Major - IntCmpU $R0 10 0 _os_check_fail _os_check_pass - GetWinVer $R1 Build - ${If} $R1 >= 22000 ; Windows 11 21H2 - Goto _os_check_pass - ${ElseIf} $R1 >= 14393 ; Windows 10 1607 - ${AndIf} ${IsNativeAMD64} ; Windows 10 has no x86_64 emulation on arm64 - Goto _os_check_pass - ${EndIf} + !if "${QT5}" == "True" + IntCmpU $R0 6 0 _os_check_fail _os_check_pass + GetWinVer $R1 Minor + IntCmpU $R1 2 _os_check_pass _os_check_fail _os_check_pass + !else + IntCmpU $R0 10 0 _os_check_fail _os_check_pass + GetWinVer $R1 Build + ${If} $R1 >= 22000 ; Windows 11 21H2 + Goto _os_check_pass + ${ElseIf} $R1 >= 14393 ; Windows 10 1607 + ${AndIf} ${IsNativeAMD64} ; Windows 10 has no x86_64 emulation on arm64 + Goto _os_check_pass + ${EndIf} + !endif ${EndIf} _os_check_fail: - MessageBox MB_OK|MB_ICONSTOP "This version of ${PRODUCT_NAME} requires a 64-bit$\r$\n\ - version of Windows 10 1607 or later." + !if "${QT5}" == "True" + MessageBox MB_OK|MB_ICONSTOP "This version of ${PRODUCT_NAME} requires a 64-bit$\r$\n\ + version of Windows 8 or later." + !else + MessageBox MB_OK|MB_ICONSTOP "This version of ${PRODUCT_NAME} requires a 64-bit$\r$\n\ + version of Windows 10 1607 or later." + !endif Abort _os_check_pass: -- cgit v1.2.3-54-g00ecf