Refactor Update-Scripts function to enhance condition checks for file existence

This commit is contained in:
2025-09-15 13:11:28 -04:00
parent 7f0fadf00b
commit cd77f094bf
3 changed files with 6 additions and 6 deletions

View File

@@ -59,7 +59,7 @@ function Update-Scripts {
}
# Check if the download was successful (file exists and is not empty)
if (Test-Path $zipPath -and (Get-Item $zipPath).Length -gt 0) {
if ((Test-Path $zipPath) -and ((Get-Item $zipPath).Length -gt 0)) {
Write-Host "Download successful!" -ForegroundColor Green
try {
@@ -70,7 +70,7 @@ function Update-Scripts {
# Find the extracted directory
$extractedDir = Get-ChildItem -Path $tempDir -Directory | Select-Object -First 1
if ($extractedDir -and (Test-Path $extractedDir.FullName)) {
if (($extractedDir) -and ((Test-Path $extractedDir.FullName))) {
# Copy all files except .git directory to current location
Write-Host "Installing updates..." -ForegroundColor Cyan
Get-ChildItem -Path $extractedDir.FullName | Where-Object { $_.Name -ne ".git" } | ForEach-Object {