Refactor Update-Scripts function to improve error handling and code structure
This commit is contained in:
@@ -57,11 +57,12 @@ function Update-Scripts {
|
||||
Write-Host "Failed to download from URL: $_" -ForegroundColor DarkGray
|
||||
return $false # Failed to download
|
||||
}
|
||||
|
||||
|
||||
# Check if the download was successful (file exists and is not empty)
|
||||
if (Test-Path $zipPath -and (Get-Item $zipPath).Length -gt 0) {
|
||||
Write-Host "Download successful!" -ForegroundColor Green
|
||||
|
||||
|
||||
try {
|
||||
# Extract the zip file
|
||||
Write-Host "Extracting update package..." -ForegroundColor Cyan
|
||||
Expand-Archive -Path $zipPath -DestinationPath $tempDir -Force
|
||||
|
||||
Reference in New Issue
Block a user