From 54bbbcce47d4c65c762d99ab41ab198b54f1ed80 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Wed, 3 Dec 2025 21:20:28 +0800 Subject: [PATCH] Safety reinforcement --- bin/clean.sh | 4 ++-- lib/core/common.sh | 6 +++--- mole | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/clean.sh b/bin/clean.sh index fbc3886..b315b8e 100755 --- a/bin/clean.sh +++ b/bin/clean.sh @@ -273,7 +273,7 @@ safe_clean() { local size size=$(get_path_size_kb "$path") local count - count=$(find -- "$path" -type f 2> /dev/null | wc -l | tr -d ' ') + count=$(find "$path" -type f 2> /dev/null | wc -l | tr -d ' ') # Use index + PID for unique filename local tmp_file="$temp_dir/result_${idx}.$$" echo "$size $count" > "$tmp_file" @@ -332,7 +332,7 @@ safe_clean() { local size_bytes size_bytes=$(get_path_size_kb "$path") local count - count=$(find -- "$path" -type f 2> /dev/null | wc -l | tr -d ' ') + count=$(find "$path" -type f 2> /dev/null | wc -l | tr -d ' ') if [[ "$count" -gt 0 && "$size_bytes" -gt 0 ]]; then if [[ "$DRY_RUN" != "true" ]]; then diff --git a/lib/core/common.sh b/lib/core/common.sh index 517d067..2c5780f 100755 --- a/lib/core/common.sh +++ b/lib/core/common.sh @@ -241,7 +241,7 @@ safe_find_delete() { fi # Execute find with safety limits - find -- "$base_dir" \ + find "$base_dir" \ -maxdepth 3 \ -name "$pattern" \ -type "$type_filter" \ @@ -277,7 +277,7 @@ safe_sudo_find_delete() { fi # Execute find with safety limits - sudo find -- "$base_dir" \ + sudo find "$base_dir" \ -maxdepth 3 \ -name "$pattern" \ -type "$type_filter" \ @@ -1150,7 +1150,7 @@ clean_tool_cache() { get_path_size_kb() { local path="$1" local result - result=$(du -sk -- "$path" 2> /dev/null | awk '{print $1}') + result=$(du -sk "$path" 2> /dev/null | awk '{print $1}') echo "${result:-0}" } diff --git a/mole b/mole index 2f591d2..55b1f4a 100755 --- a/mole +++ b/mole @@ -22,7 +22,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/lib/core/common.sh" # Version info -VERSION="1.11.18" +VERSION="1.11.19" MOLE_TAGLINE="can dig deep to clean your Mac." # Check if Touch ID is already configured