Skip to content

Commit f1d5b16

Browse files
authored
Updated VC++ Redistributable to 14.40.33810.0 (#542)
1 parent 2019c08 commit f1d5b16

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

install.ps1

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -264,28 +264,22 @@ Write-Host 'Patching Spotify...'
264264
$patchFiles = (Join-Path -Path $PWD -ChildPath 'dpapi.dll'), (Join-Path -Path $PWD -ChildPath 'config.ini')
265265

266266
Copy-Item -LiteralPath $patchFiles -Destination "$spotifyDirectory"
267+
Remove-Item -LiteralPath (Join-Path -Path $spotifyDirectory -ChildPath 'blockthespot_settings.json') -Force # temporary
267268

268269
function Install-VcRedist {
269-
# https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
270-
$vcRedistX86Url = "https://aka.ms/vs/17/release/vc_redist.x86.exe"
271-
$vcRedistX64Url = "https://aka.ms/vs/17/release/vc_redist.x64.exe"
272-
273-
if ([Environment]::Is64BitOperatingSystem) {
274-
if (!(Test-Path 'HKLM:\Software\Microsoft\VisualStudio\14.0\VC\Runtimes\x64')) {
275-
$vcRedistX64File = Join-Path -Path $PWD -ChildPath 'vc_redist.x64.exe'
276-
Write-Host "Downloading and installing vc_redist.x64.exe..."
277-
Get-File -Uri $vcRedistX64Url -TargetFile $vcRedistX64File
278-
Start-Process -FilePath $vcRedistX64File -ArgumentList "/install /quiet /norestart" -Wait
279-
}
280-
}
281-
else {
282-
if (!(Test-Path 'HKLM:\Software\Microsoft\VisualStudio\14.0\VC\Runtimes\x86')) {
283-
$vcRedistX86File = Join-Path -Path $PWD -ChildPath 'vc_redist.x86.exe'
284-
Write-Host "Downloading and installing vc_redist.x86.exe..."
285-
Get-File -Uri $vcRedistX86Url -TargetFile $vcRedistX86File
286-
Start-Process -FilePath $vcRedistX86File -ArgumentList "/install /quiet /norestart" -Wait
287-
}
288-
}
270+
$architecture = if ([Environment]::Is64BitOperatingSystem) { "x64" } else { "x86" }
271+
# https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
272+
$vcRedistUrl = "https://aka.ms/vs/17/release/vc_redist.$($architecture).exe"
273+
$registryPath = "HKLM:\Software\Microsoft\VisualStudio\14.0\VC\Runtimes\$architecture"
274+
$installedVersion = [version]((Get-ItemProperty $registryPath -ErrorAction SilentlyContinue).Version).Substring(1)
275+
$latestVersion = [version]"14.40.33810.0"
276+
277+
if ($installedVersion -lt $latestVersion) {
278+
$vcRedistFile = Join-Path -Path $PWD -ChildPath "vc_redist.$architecture.exe"
279+
Write-Host "Downloading and installing vc_redist.$architecture.exe..."
280+
Invoke-WebRequest -Uri $vcRedistUrl -OutFile $vcRedistFile
281+
Start-Process -FilePath $vcRedistFile -ArgumentList "/install /quiet /norestart" -Wait
282+
}
289283
}
290284

291285
Install-VcRedist

0 commit comments

Comments
 (0)