chore: install vc_redist.x64 from script
This commit is contained in:
parent
2a905c6c02
commit
f1d97ac834
@ -77,6 +77,25 @@ async function main() {
|
|||||||
// Expect EEXIST error
|
// Expect EEXIST error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Download VC++ Redistributable 17
|
||||||
|
if (platform == 'win32') {
|
||||||
|
const vcFilename = 'vc_redist.x64.exe'
|
||||||
|
const vcUrl = 'https://aka.ms/vs/17/release/vc_redist.x64.exe'
|
||||||
|
|
||||||
|
console.log(`Downloading VC++ Redistributable...`)
|
||||||
|
const vcSavePath = path.join(tempDir, vcFilename)
|
||||||
|
if (!fs.existsSync(vcSavePath)) {
|
||||||
|
await download(vcUrl, vcSavePath)
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy to tauri resources
|
||||||
|
try {
|
||||||
|
copySync(vcSavePath, resourcesDir)
|
||||||
|
} catch (err) {
|
||||||
|
// Expect EEXIST error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
console.log('Downloads completed.')
|
console.log('Downloads completed.')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"targets": ["nsis"],
|
"targets": ["nsis"],
|
||||||
"resources": ["resources/pre-install/**/*", "resources/lib/vulkan-1.dll", "resources/LICENSE"],
|
"resources": ["resources/pre-install/**/*", "resources/lib/vulkan-1.dll", "resources/lib/vc_redist.x64.exe", "resources/LICENSE"],
|
||||||
"externalBin": ["resources/bin/bun", "resources/bin/uv"],
|
"externalBin": ["resources/bin/bun", "resources/bin/uv"],
|
||||||
"windows": {
|
"windows": {
|
||||||
"nsis": {
|
"nsis": {
|
||||||
|
|||||||
@ -8,37 +8,31 @@
|
|||||||
|
|
||||||
${If} $0 == ""
|
${If} $0 == ""
|
||||||
; VC++ Redistributable not found, need to install
|
; VC++ Redistributable not found, need to install
|
||||||
DetailPrint "Visual C++ Redistributable not found, downloading and installing..."
|
DetailPrint "Visual C++ Redistributable not found, installing from bundled file..."
|
||||||
|
|
||||||
; Download VC++ Redistributable
|
; Install from bundled EXE if not installed
|
||||||
Delete "$TEMP\vc_redist.x64.exe"
|
${If} ${FileExists} "$INSTDIR\resources\lib\vc_redist.x64.exe"
|
||||||
DetailPrint "Downloading Visual C++ Redistributable..."
|
|
||||||
NSISdl::download "https://aka.ms/vs/17/release/vc_redist.x64.exe" "$TEMP\vc_redist.x64.exe"
|
|
||||||
Pop $1
|
|
||||||
|
|
||||||
${If} $1 == "success"
|
|
||||||
DetailPrint "Visual C++ Redistributable download successful"
|
|
||||||
|
|
||||||
; Install VC++ Redistributable silently
|
|
||||||
DetailPrint "Installing Visual C++ Redistributable..."
|
DetailPrint "Installing Visual C++ Redistributable..."
|
||||||
ExecWait '"$TEMP\vc_redist.x64.exe" /quiet /norestart' $2
|
; Copy to TEMP folder and then execute installer
|
||||||
|
CopyFiles "$INSTDIR\resources\lib\vc_redist.x64.exe" "$TEMP\vc_redist.x64.exe"
|
||||||
${If} $2 == 0
|
ExecWait '"$TEMP\vc_redist.x64.exe" /quiet /norestart' $1
|
||||||
|
|
||||||
|
; Check whether installation process exited successfully (code 0) or not
|
||||||
|
${If} $1 == 0
|
||||||
DetailPrint "Visual C++ Redistributable installed successfully"
|
DetailPrint "Visual C++ Redistributable installed successfully"
|
||||||
${ElseIf} $2 == 1638
|
${ElseIf} $1 == 1638
|
||||||
DetailPrint "Visual C++ Redistributable already installed (newer version)"
|
DetailPrint "Visual C++ Redistributable already installed (newer version)"
|
||||||
${ElseIf} $2 == 3010
|
${ElseIf} $1 == 3010
|
||||||
DetailPrint "Visual C++ Redistributable installed successfully (restart required)"
|
DetailPrint "Visual C++ Redistributable installed successfully (restart required)"
|
||||||
${Else}
|
${Else}
|
||||||
DetailPrint "Visual C++ installation failed with exit code: $2"
|
DetailPrint "Visual C++ installation failed with exit code: $1"
|
||||||
MessageBox MB_ICONEXCLAMATION "Visual C++ installation failed. Some features may not work."
|
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
; Clean up downloaded file
|
; Clean up setup files from TEMP and your installed app
|
||||||
Delete "$TEMP\vc_redist.x64.exe"
|
Delete "$TEMP\vc_redist.x64.exe"
|
||||||
|
Delete "$INSTDIR\resources\lib\vc_redist.x64.exe"
|
||||||
${Else}
|
${Else}
|
||||||
DetailPrint "Failed to download Visual C++ Redistributable: $1"
|
DetailPrint "Visual C++ Redistributable not found at expected location: $INSTDIR\resources\lib\vc_redist.x64.exe"
|
||||||
MessageBox MB_ICONEXCLAMATION "Failed to download Visual C++ Redistributable. Some features may not work."
|
|
||||||
${EndIf}
|
${EndIf}
|
||||||
${Else}
|
${Else}
|
||||||
DetailPrint "Visual C++ Redistributable already installed (version: $0)"
|
DetailPrint "Visual C++ Redistributable already installed (version: $0)"
|
||||||
@ -57,7 +51,7 @@
|
|||||||
|
|
||||||
; Optional cleanup - remove from resources folder
|
; Optional cleanup - remove from resources folder
|
||||||
Delete "$INSTDIR\resources\lib\vulkan-1.dll"
|
Delete "$INSTDIR\resources\lib\vulkan-1.dll"
|
||||||
; Only remove the lib directory if it's empty
|
; Only remove the lib directory if it's empty after removing both files
|
||||||
RMDir "$INSTDIR\resources\lib"
|
RMDir "$INSTDIR\resources\lib"
|
||||||
${Else}
|
${Else}
|
||||||
DetailPrint "vulkan-1.dll not found at expected location: $INSTDIR\resources\lib\vulkan-1.dll"
|
DetailPrint "vulkan-1.dll not found at expected location: $INSTDIR\resources\lib\vulkan-1.dll"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user