fix: don't remove SVR.JS zip archive when installed manually

This commit is contained in:
Dorian Niemiec 2025-01-05 10:10:48 +01:00
parent 400eef1692
commit e1359e25b4

View file

@ -61,7 +61,9 @@ if (!(Test-Path -Path "$env:SYSTEMDRIVE\svrjs\svrjs")) {
}
# Download SVR.JS zip archive
$manuallyInstalled = $False
if ($installType -eq "manual") {
$manuallyInstalled = $True
$svrjsZipArchive = Read-Host "Path to SVR.JS zip archive"
} elseif ($INSTALLTYPE -eq "stable") {
$svrjsVersion = (Invoke-RestMethod -Uri "https://downloads.svrjs.org/latest.svrjs").Trim()
@ -127,7 +129,9 @@ Remove-Item -Path $nodejsZipArchive
# Extract SVR.JS files
Write-Host "Extracting SVR.JS files..."
Expand-Archive -Path $svrjsZipArchive -DestinationPath "$env:SYSTEMDRIVE\svrjs\svrjs" -Force
if (!($manuallyInstalled)) {
Remove-Item -Path $svrjsZipArchive
}
if (Test-Path -Path "$env:SYSTEMDRIVE\svrjs\svrjs\svr.compressed" -PathType "Leaf") {
Push-Location
Set-Location -Path "$env:SYSTEMDRIVE\svrjs\svrjs"