From ef0e34a2147f8ac8912c57a5bd6e8a6a65fccf55 Mon Sep 17 00:00:00 2001 From: tw93 Date: Sat, 21 Feb 2026 20:22:06 +0800 Subject: [PATCH] refactor(clean): optimize Group Containers directory check - Replace ls with find -maxdepth 1 to reduce IO and permission noise - Keep same behavior: silently skip if directory is empty or inaccessible Addresses: user.sh (line 484) --- lib/clean/user.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/clean/user.sh b/lib/clean/user.sh index 532b339..cf96fdf 100644 --- a/lib/clean/user.sh +++ b/lib/clean/user.sh @@ -481,7 +481,7 @@ process_container_cache() { clean_group_container_caches() { local group_containers_dir="$HOME/Library/Group Containers" [[ -d "$group_containers_dir" ]] || return 0 - if ! ls "$group_containers_dir" > /dev/null 2>&1; then + if ! find "$group_containers_dir" -mindepth 1 -maxdepth 1 -print -quit 2> /dev/null | grep -q .; then return 0 fi