diff --git a/windows/bin/purge.ps1 b/windows/bin/purge.ps1 index 5a5965e..c897422 100644 --- a/windows/bin/purge.ps1 +++ b/windows/bin/purge.ps1 @@ -473,20 +473,16 @@ function Remove-ProjectArtifacts { foreach ($artifact in $project.Artifacts) { if (Test-Path $artifact.Path) { - try { - if ($artifact.Type -eq "Directory") { - Remove-Item -Path $artifact.Path -Recurse -Force -ErrorAction Stop - } - else { - Remove-Item -Path $artifact.Path -Force -ErrorAction Stop - } - + # Use safe removal with protection checks + $result = Remove-SafeItem -Path $artifact.Path -Description $artifact.Name -Recurse + + if ($result.Removed -gt 0) { Write-Host " $esc[32m$($script:Icons.Success)$esc[0m $($artifact.Name) ($($artifact.SizeHuman))" $script:TotalSizeCleaned += $artifact.SizeKB $script:ItemsCleaned++ } - catch { - Write-Host " $esc[31m$($script:Icons.Error)$esc[0m $($artifact.Name) - $_" + elseif ($result.Failed -gt 0) { + Write-Host " $esc[31m$($script:Icons.Error)$esc[0m $($artifact.Name) - removal failed" } } } diff --git a/windows/cmd/analyze/main.go b/windows/cmd/analyze/main.go index ca382c7..4251932 100644 --- a/windows/cmd/analyze/main.go +++ b/windows/cmd/analyze/main.go @@ -7,6 +7,7 @@ import ( "flag" "fmt" "os" + "os/exec" "path/filepath" "runtime" "sort" @@ -671,19 +672,11 @@ func truncatePath(path string, maxLen int) string { // openInExplorer opens a path in Windows Explorer func openInExplorer(path string) { // Use explorer.exe to open the path - cmd := fmt.Sprintf("explorer.exe /select,\"%s\"", path) go func() { - _ = runCommand("cmd", "/c", cmd) + exec.Command("explorer.exe", "/select,", path).Run() }() } -// runCommand runs a command and returns the output -func runCommand(name string, args ...string) error { - cmd := fmt.Sprintf("%s %s", name, strings.Join(args, " ")) - _ = cmd - return nil -} - func main() { var startPath string diff --git a/windows/lib/clean/apps.ps1 b/windows/lib/clean/apps.ps1 index 2ec6557..ceb9460 100644 --- a/windows/lib/clean/apps.ps1 +++ b/windows/lib/clean/apps.ps1 @@ -207,7 +207,7 @@ function Clear-OneDriveCache { } } -function Clear-DroplboxCache { +function Clear-DropboxCache { <# .SYNOPSIS Clean Dropbox cache @@ -405,7 +405,7 @@ function Invoke-AppCleanup { # Productivity apps Clear-OfficeCache Clear-OneDriveCache - Clear-DroplboxCache + Clear-DropboxCache Clear-GoogleDriveCache # Creative apps diff --git a/windows/lib/clean/user.ps1 b/windows/lib/clean/user.ps1 index 61aef59..448f1e5 100644 --- a/windows/lib/clean/user.ps1 +++ b/windows/lib/clean/user.ps1 @@ -289,6 +289,9 @@ function Clear-ClipboardHistory { } try { + # Load Windows Forms assembly for clipboard access + Add-Type -AssemblyName System.Windows.Forms -ErrorAction SilentlyContinue + # Clear current clipboard [System.Windows.Forms.Clipboard]::Clear()