fix: windows arm64 vsruntime is not installed

This commit is contained in:
huzibaca 2024-11-16 03:12:11 +08:00
parent ec6705eaf4
commit 97717c648e
No known key found for this signature in database
GPG Key ID: D4364EE4851DC302

View File

@ -697,33 +697,26 @@ Var VC_REDIST_URL
Var VC_REDIST_EXE Var VC_REDIST_EXE
Section CheckAndInstallVSRuntime Section CheckAndInstallVSRuntime
; Set default values for x86 ${If} ${IsNativeARM64}
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.arm64.exe"
StrCpy $VC_REDIST_EXE "vc_redist.x86.exe" StrCpy $VC_REDIST_EXE "vc_redist.arm64.exe"
IfFileExists "$SYSDIR\msvcp140.dll" Done
${If} ${RunningX64} ${ElseIf} ${RunningX64}
; 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}
${If} ${RunningX64}
IfFileExists "$WINDIR\SysWOW64\msvcp140.dll" Done IfFileExists "$WINDIR\SysWOW64\msvcp140.dll" Done
${Else}
StrCpy $VC_REDIST_URL "https://aka.ms/vs/17/release/vc_redist.x86.exe"
StrCpy $VC_REDIST_EXE "vc_redist.x86.exe"
IfFileExists "$SYSDIR\msvcp140.dll" Done
${EndIf} ${EndIf}
IfFileExists "$SYSDIR\msvcp140.dll" Done ; 下载并安装VC运行库
; 如果文件不存在,进行安装
; 下载文件
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 ${If} $0 == "success"
; 下载失败时,直接跳转到结束
Goto Done
; 安装运行库
nsExec::Exec '"$TEMP\$VC_REDIST_EXE" /quiet /norestart' nsExec::Exec '"$TEMP\$VC_REDIST_EXE" /quiet /norestart'
${EndIf}
Done: Done:
SectionEnd SectionEnd