Skip to content

Commit

Permalink
test-path before trying to delete
Browse files Browse the repository at this point in the history
  • Loading branch information
rrelmy committed Mar 25, 2017
1 parent 732cf2c commit 355dde0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libexec/scoop-uninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ foreach($app in $apps) {
if ($purge) {
$data_dir = appdatadir $app

try { rm -r $data_dir -ea stop -force }
catch { abort "Couldn't remove '$(friendly_path $data_dir)'; it may be in use." }
if (Test-Path $data_dir) {
try { rm -r $data_dir -ea stop -force }
catch { abort "Couldn't remove '$(friendly_path $data_dir)'; it may be in use." }
}
}

success "'$app' was uninstalled."
Expand Down

0 comments on commit 355dde0

Please sign in to comment.