From 3255fa2451fd1240c6cf6fb668dd83778a512342 Mon Sep 17 00:00:00 2001 From: Bhadra Date: Thu, 8 Jan 2026 21:37:07 +0530 Subject: [PATCH] fix(windows): fix CI function name and purge return type handling - Fix Test-IsProtectedPath -> Test-ProtectedPath in CI workflow - Fix purge.ps1 to handle boolean return from Remove-SafeItem - Add C:\Program Files and C:\Program Files (x86) to ProtectedPaths --- .github/workflows/windows.yml | 2 +- windows/bin/purge.ps1 | 8 ++++---- windows/lib/core/base.ps1 | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 1cb8c61..69484db 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -188,7 +188,7 @@ jobs: ) foreach ($path in $protectedPaths) { - if (-not (Test-IsProtectedPath -Path $path)) { + if (-not (Test-ProtectedPath -Path $path)) { Write-Host "✗ $path should be protected!" -ForegroundColor Red exit 1 } diff --git a/windows/bin/purge.ps1 b/windows/bin/purge.ps1 index c897422..7b8d9a5 100644 --- a/windows/bin/purge.ps1 +++ b/windows/bin/purge.ps1 @@ -473,15 +473,15 @@ function Remove-ProjectArtifacts { foreach ($artifact in $project.Artifacts) { if (Test-Path $artifact.Path) { - # Use safe removal with protection checks - $result = Remove-SafeItem -Path $artifact.Path -Description $artifact.Name -Recurse + # Use safe removal with protection checks (returns boolean) + $success = Remove-SafeItem -Path $artifact.Path -Description $artifact.Name -Recurse - if ($result.Removed -gt 0) { + if ($success) { Write-Host " $esc[32m$($script:Icons.Success)$esc[0m $($artifact.Name) ($($artifact.SizeHuman))" $script:TotalSizeCleaned += $artifact.SizeKB $script:ItemsCleaned++ } - elseif ($result.Failed -gt 0) { + else { Write-Host " $esc[31m$($script:Icons.Error)$esc[0m $($artifact.Name) - removal failed" } } diff --git a/windows/lib/core/base.ps1 b/windows/lib/core/base.ps1 index 1712130..9f6b777 100644 --- a/windows/lib/core/base.ps1 +++ b/windows/lib/core/base.ps1 @@ -87,6 +87,8 @@ $script:ProtectedPaths = @( "C:\Windows" "C:\Windows\System32" "C:\Windows\SysWOW64" + "C:\Program Files" + "C:\Program Files (x86)" "C:\Program Files\Windows Defender" "C:\Program Files (x86)\Windows Defender" "C:\ProgramData\Microsoft\Windows Defender"