@@ -736,54 +736,54 @@ find_app_receipt_files() {
736736 # Whitelisted prefixes
737737 case " $clean_path " in
738738 /Applications/* ) is_safe=true ;;
739- /Users/* ) is_safe=true ;;
740- /usr/local/* ) is_safe=true ;;
741- /opt/* ) is_safe=true ;;
742- /Library/* )
743- # Filter sub-paths in /Library to avoid system damage
744- # Allow safely: Application Support, Caches, Logs, Preferences
745- case " $clean_path " in
746- /Library/Application\ Support/* ) is_safe=true ;;
747- /Library/Caches/* ) is_safe=true ;;
748- /Library/Logs/* ) is_safe=true ;;
749- /Library/Preferences/* ) is_safe=true ;;
750- /Library/PrivilegedHelperTools/* ) is_safe=true ;;
751- /Library/LaunchAgents/* ) is_safe=true ;;
752- /Library/LaunchDaemons/* ) is_safe=true ;;
753- /Library/Internet\ Plug-Ins/* ) is_safe=true ;;
754- /Library/Audio/Plug-Ins/* ) is_safe=true ;;
755- /Library/Extensions/* ) is_safe=false ;; # Default unsafe
756- * ) is_safe=false ;;
757- esac
758- ;;
759- esac
760-
761- # Hard blocks
762- case " $clean_path " in
763- /System/* | /usr/bin/* | /usr/lib/* | /bin/* | /sbin/* ) is_safe=false ;;
764- esac
765-
766- if [[ " $is_safe " == " true" && -e " $clean_path " ]]; then
767- # Only valid files
768- # Don't delete directories if they are non-empty parents?
769- # lsbom lists directories too.
770- # If we return a directory, `safe_remove` logic handles it.
771- # `uninstall.sh` uses `remove_file_list`.
772- # If `lsbom` lists `/Applications` (it shouldn't, only contents), we must be careful.
773- # `lsbom` usually lists `./Applications/MyApp.app`.
774- # If it lists `./Applications`, we must skip it.
775-
776- # Extra check: path must be deep enough?
777- # If path is just "/Applications", skip.
778- if [[ " $clean_path " == " /Applications" || " $clean_path " == " /Library" || " $clean_path " == " /usr/local" ]]; then
779- continue
739+ /Users/* ) is_safe=true ;;
740+ /usr/local/* ) is_safe=true ;;
741+ /opt/* ) is_safe=true ;;
742+ /Library/* )
743+ # Filter sub-paths in /Library to avoid system damage
744+ # Allow safely: Application Support, Caches, Logs, Preferences
745+ case " $clean_path " in
746+ /Library/Application\ Support/* ) is_safe=true ;;
747+ /Library/Caches/* ) is_safe=true ;;
748+ /Library/Logs/* ) is_safe=true ;;
749+ /Library/Preferences/* ) is_safe=true ;;
750+ /Library/PrivilegedHelperTools/* ) is_safe=true ;;
751+ /Library/LaunchAgents/* ) is_safe=true ;;
752+ /Library/LaunchDaemons/* ) is_safe=true ;;
753+ /Library/Internet\ Plug-Ins/* ) is_safe=true ;;
754+ /Library/Audio/Plug-Ins/* ) is_safe=true ;;
755+ /Library/Extensions/* ) is_safe=false ;; # Default unsafe
756+ * ) is_safe=false ;;
757+ esac
758+ ;;
759+ esac
760+
761+ # Hard blocks
762+ case " $clean_path " in
763+ /System/* | /usr/bin/* | /usr/lib/* | /bin/* | /sbin/* ) is_safe=false ;;
764+ esac
765+
766+ if [[ " $is_safe " == " true" && -e " $clean_path " ]]; then
767+ # Only valid files
768+ # Don't delete directories if they are non-empty parents?
769+ # lsbom lists directories too.
770+ # If we return a directory, `safe_remove` logic handles it.
771+ # `uninstall.sh` uses `remove_file_list`.
772+ # If `lsbom` lists `/Applications` (it shouldn't, only contents), we must be careful.
773+ # `lsbom` usually lists `./Applications/MyApp.app`.
774+ # If it lists `./Applications`, we must skip it.
775+
776+ # Extra check: path must be deep enough?
777+ # If path is just "/Applications", skip.
778+ if [[ " $clean_path " == " /Applications" || " $clean_path " == " /Library" || " $clean_path " == " /usr/local" ]]; then
779+ continue
780+ fi
781+
782+ receipt_files+=(" $clean_path " )
780783 fi
781784
782- receipt_files+=(" $clean_path " )
783- fi
784-
785- done <<< " $bom_content"
786- done
785+ done <<< " $bom_content"
786+ done
787787 fi
788788 if [[ ${# receipt_files[@]} -gt 0 ]]; then
789789 printf ' %s\n' " ${receipt_files[@]} "
0 commit comments