fix: 安装时检测 WebView2 并给出中文提示

This commit is contained in:
2026-10-25 07:39:44 +08:00
parent 6e2189d96e
commit 2bec6bf8a2
2 changed files with 20 additions and 1 deletions
+18
View File
@@ -0,0 +1,18 @@
; 安装时检查 WebView2。不把约 120MB 的离线运行库打进安装包。
; 缺少运行库时给出中文说明,安装本身继续,便于之后补装运行库再打开程序。
!macro NSIS_HOOK_PREINSTALL
${If} ${RunningX64}
ReadRegStr $R8 HKLM "SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
${Else}
ReadRegStr $R8 HKLM "SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
${EndIf}
${If} $R8 == ""
ReadRegStr $R8 HKCU "SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv"
${EndIf}
${If} $R8 == ""
${OrIf} $R8 == "0.0.0.0"
MessageBox MB_ICONEXCLAMATION|MB_OK "未检测到 Microsoft Edge WebView2 运行库。$\r$\n$\r$\nNqiTools 需要它才能打开界面。安装仍会继续。$\r$\n请向管理员索取 WebView2 Evergreen 离线安装包,安装完成后再启动 NqiTools。"
${EndIf}
!macroend
+2 -1
View File
@@ -41,7 +41,8 @@
"nsis": {
"installMode": "currentUser",
"languages": ["SimpChinese"],
"displayLanguageSelector": false
"displayLanguageSelector": false,
"installerHooks": "nsis/webview2-check.nsh"
}
}
}