diff --git a/core/cli/packages.el b/core/cli/packages.el index 8f1bfeb85..662f5f924 100644 --- a/core/cli/packages.el +++ b/core/cli/packages.el @@ -286,12 +286,12 @@ a list of packages that will be updated." (dolist (it packages) (print! (info "Deleting %s/%s") label it) (dolist (path (list ,@files)) - (if (file-directory-p path) - (delete-directory path 'recursive) - (if (file-exists-p path) - (delete-file path) - (print! (error "Failed to find %s/%s") label it))) - (unless (file-exists-p path) + (cond ((file-directory-p path) + (delete-directory path 'recursive)) + ((file-regular-p path) + (delete-file path))) + (if (file-exists-p path) + (print! (error "Failed to find %s/%s") label it) (cl-incf n)))) (if (= n 0) (ignore (print! (warn "Didn't prune any %s(s) for some reason" label)))