chore: update

This commit is contained in:
huzibaca 2024-11-06 10:17:40 +08:00
parent 792f1826ee
commit 01bde19701

View File

@ -1,6 +1,7 @@
; This file is copied from https://github.com/tauri-apps/tauri/blob/tauri-v1.5/tooling/bundler/src/bundle/windows/templates/installer.nsi ; This file is copied from https://github.com/tauri-apps/tauri/blob/tauri-v1.5/tooling/bundler/src/bundle/windows/templates/installer.nsi
; and edit to fit the needs of the project. the latest tauri 2.x has a different base nsi script. ; and edit to fit the needs of the project. the latest tauri 2.x has a different base nsi script.
RequestExecutionLevel admin RequestExecutionLevel admin
Unicode true Unicode true
; Set the compression algorithm. Default is LZMA. ; Set the compression algorithm. Default is LZMA.
!if "{{compression}}" == "" !if "{{compression}}" == ""
@ -573,8 +574,6 @@ FunctionEnd
${EndIf} ${EndIf}
!macroend !macroend
Section EarlyChecks Section EarlyChecks
; Abort silent installer if downgrades is disabled ; Abort silent installer if downgrades is disabled
!if "${ALLOWDOWNGRADES}" == "false" !if "${ALLOWDOWNGRADES}" == "false"
@ -692,6 +691,8 @@ SectionEnd
app_check_done: app_check_done:
!macroend !macroend
Var VC_REDIST_URL Var VC_REDIST_URL
Var VC_REDIST_EXE Var VC_REDIST_EXE
@ -700,42 +701,35 @@ Section CheckAndInstallVSRuntime
StrCpy $VC_REDIST_URL "https://aka.ms/vs/17/release/vc_redist.x86.exe" StrCpy $VC_REDIST_URL "https://aka.ms/vs/17/release/vc_redist.x86.exe"
StrCpy $VC_REDIST_EXE "vc_redist.x86.exe" StrCpy $VC_REDIST_EXE "vc_redist.x86.exe"
${If} ${Is64Bit} ${If} ${RunningX64}
; Update values for x64 ; Update values for x64
StrCpy $VC_REDIST_URL "https://aka.ms/vs/17/release/vc_redist.x64.exe" StrCpy $VC_REDIST_URL "https://aka.ms/vs/17/release/vc_redist.x64.exe"
StrCpy $VC_REDIST_EXE "vc_redist.x64.exe" StrCpy $VC_REDIST_EXE "vc_redist.x64.exe"
${EndIf} ${EndIf}
; 检查运行库文件是否存在
; 对于 64 位系统检查 32 位运行时文件 ${If} ${RunningX64}
${If} ${Is64Bit} IfFileExists "$WINDIR\SysWOW64\msvcp140.dll" Done
IfFileExists "$WINDIR\SysWOW64\msvcp140.dll" AlreadyInstalled
${EndIf} ${EndIf}
; 对于 32 位系统或者 64 位系统的 64 位运行时 IfFileExists "$SYSDIR\msvcp140.dll" Done
IfFileExists "$SYSDIR\msvcp140.dll" AlreadyInstalled
; 如果文件不存在进行安装 ; 如果文件不存在进行安装
MessageBox MB_OK "Visual Studio Runtime is not installed. Installing now..."
; 下载文件 ; 下载文件
nsisdl::download "$VC_REDIST_URL" "$TEMP\$VC_REDIST_EXE" nsisdl::download "$VC_REDIST_URL" "$TEMP\$VC_REDIST_EXE"
Pop $0 ; 获取下载结果 Pop $0 ; 获取下载结果
StrCmp $0 "success" +2 StrCmp $0 "success" +2
MessageBox MB_OK "Download failed. Please check your internet connection." IDOK Done ; 下载失败时直接跳转到结束
Goto Done
; 安装运行库 ; 安装运行库
ExecWait '"$TEMP\$VC_REDIST_EXE" /quiet /norestart' nsExec::Exec '"$TEMP\$VC_REDIST_EXE" /quiet /norestart'
Goto Done
AlreadyInstalled:
MessageBox MB_OK "Visual Studio Runtime is already installed."
Done: Done:
SectionEnd SectionEnd
Section Install Section Install
SetOutPath $INSTDIR SetOutPath $INSTDIR
nsExec::Exec 'netsh int tcp res' nsExec::Exec 'netsh int tcp res'