Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.
chore: install vc_redist.x64 from script
Minh141120f1d97ac8348d
diff --git a/scripts/download-lib.mjs b/scripts/download-lib.mjsindex d2086b36e..ab73b8d79 100644--- a/scripts/download-lib.mjs+++ b/scripts/download-lib.mjs@@ -77,6 +77,25 @@ async function main() {// 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.')}diff --git a/src-tauri/tauri.windows.conf.json b/src-tauri/tauri.windows.conf.jsonindex 664053705..16cb9b10a 100644--- a/src-tauri/tauri.windows.conf.json+++ b/src-tauri/tauri.windows.conf.json@@ -1,7 +1,7 @@{"bundle": {"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"],"windows": {"nsis": {diff --git a/src-tauri/windows/hooks.nsh b/src-tauri/windows/hooks.nshindex 60aec1c80..5e1a32141 100644--- a/src-tauri/windows/hooks.nsh+++ b/src-tauri/windows/hooks.nsh@@ -8,37 +8,31 @@${If} $0 == ""; VC++ Redistributable not found, need to install- DetailPrint "Visual C++ Redistributable not found, downloading and installing..."-- ; Download VC++ Redistributable- Delete "$TEMP\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 "Visual C++ Redistributable not found, installing from bundled file..."++ ; Install from bundled EXE if not installed+ ${If} ${FileExists} "$INSTDIR\resources\lib\vc_redist.x64.exe"DetailPrint "Installing Visual C++ Redistributable..."- ExecWait '"$TEMP\vc_redist.x64.exe" /quiet /norestart' $2-- ${If} $2 == 0+ ; Copy to TEMP folder and then execute installer+ CopyFiles "$INSTDIR\resources\lib\vc_redist.x64.exe" "$TEMP\vc_redist.x64.exe"+ ExecWait '"$TEMP\vc_redist.x64.exe" /quiet /norestart' $1++ ; Check whether installation process exited successfully (code 0) or not+ ${If} $1 == 0DetailPrint "Visual C++ Redistributable installed successfully"- ${ElseIf} $2 == 1638+ ${ElseIf} $1 == 1638DetailPrint "Visual C++ Redistributable already installed (newer version)"- ${ElseIf} $2 == 3010+ ${ElseIf} $1 == 3010DetailPrint "Visual C++ Redistributable installed successfully (restart required)"${Else}- DetailPrint "Visual C++ installation failed with exit code: $2"- MessageBox MB_ICONEXCLAMATION "Visual C++ installation failed. Some features may not work."+ DetailPrint "Visual C++ installation failed with exit code: $1"${EndIf}-- ; Clean up downloaded file++ ; Clean up setup files from TEMP and your installed appDelete "$TEMP\vc_redist.x64.exe"+ Delete "$INSTDIR\resources\lib\vc_redist.x64.exe"${Else}- DetailPrint "Failed to download Visual C++ Redistributable: $1"- MessageBox MB_ICONEXCLAMATION "Failed to download Visual C++ Redistributable. Some features may not work."+ DetailPrint "Visual C++ Redistributable not found at expected location: $INSTDIR\resources\lib\vc_redist.x64.exe"${EndIf}${Else}DetailPrint "Visual C++ Redistributable already installed (version: $0)"@@ -57,7 +51,7 @@; Optional cleanup - remove from resources folderDelete "$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 filesRMDir "$INSTDIR\resources\lib"${Else}DetailPrint "vulkan-1.dll not found at expected location: $INSTDIR\resources\lib\vulkan-1.dll"