1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-05 04:29:45 +00:00

Safer cleaning and enhancement capabilities

This commit is contained in:
Tw93
2025-11-29 22:43:57 +09:00
parent 1ded1c9a82
commit 75bd91840f
8 changed files with 242 additions and 100 deletions

View File

@@ -199,16 +199,16 @@ batch_uninstall_applications() {
fi
if [[ -z "$reason" ]]; then
if [[ "$needs_sudo" == true ]]; then
sudo rm -rf "$app_path" 2> /dev/null || reason="remove failed"
safe_sudo_remove "$app_path" || reason="remove failed"
else
rm -rf "$app_path" 2> /dev/null || reason="remove failed"
safe_remove "$app_path" true || reason="remove failed"
fi
fi
if [[ -z "$reason" ]]; then
local files_removed=0
while IFS= read -r file; do
[[ -n "$file" && -e "$file" ]] || continue
rm -rf "$file" 2> /dev/null && ((files_removed++)) || true
safe_remove "$file" true && ((files_removed++)) || true
done <<< "$related_files"
((total_size_freed += total_kb))
((success_count++))