1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 22:30:08 +00:00

uninstall: refine protection flow and menu filtering

This commit is contained in:
tw93
2026-02-03 17:36:15 +08:00
parent bad1c71231
commit 579c963940
3 changed files with 34 additions and 42 deletions

View File

@@ -707,7 +707,13 @@ should_protect_data() {
;;
esac
# Most apps won't match, return early
# Fallback: check against the full DATA_PROTECTED_BUNDLES list
for pattern in "${DATA_PROTECTED_BUNDLES[@]}"; do
if bundle_matches_pattern "$bundle_id" "$pattern"; then
return 0
fi
done
return 1
}
@@ -772,7 +778,8 @@ should_protect_path() {
# Matches: .../Library/Group Containers/group.id/...
if [[ "$path" =~ /Library/Containers/([^/]+) ]] || [[ "$path" =~ /Library/Group\ Containers/([^/]+) ]]; then
local bundle_id="${BASH_REMATCH[1]}"
if should_protect_data "$bundle_id"; then
# In uninstall mode, only system components are protected; skip data protection
if [[ "${MOLE_UNINSTALL_MODE:-0}" != "1" ]] && should_protect_data "$bundle_id"; then
return 0
fi
fi