1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-16 23:24:11 +00:00

Compatible with German and French system users

This commit is contained in:
Tw93
2025-10-08 11:31:03 +08:00
parent 01b74c076e
commit 1ae3479072
3 changed files with 17 additions and 7 deletions

View File

@@ -4,6 +4,10 @@
set -euo pipefail set -euo pipefail
# Fix locale issues (avoid Perl warnings on non-English systems)
export LC_ALL=C
export LANG=C
# Get script directory for sourcing libraries # Get script directory for sourcing libraries
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
LIB_DIR="$(dirname "$SCRIPT_DIR")/lib" LIB_DIR="$(dirname "$SCRIPT_DIR")/lib"

View File

@@ -8,6 +8,10 @@
set -euo pipefail set -euo pipefail
# Fix locale issues (avoid Perl warnings on non-English systems)
export LC_ALL=C
export LANG=C
# Get script directory and source common functions # Get script directory and source common functions
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../lib/common.sh" source "$SCRIPT_DIR/../lib/common.sh"
@@ -111,7 +115,8 @@ scan_applications() {
# Cache is valid if: age < TTL AND app count matches # Cache is valid if: age < TTL AND app count matches
if [[ $cache_age -lt $cache_ttl && "$cached_app_count" == "$current_app_count" ]]; then if [[ $cache_age -lt $cache_ttl && "$cached_app_count" == "$current_app_count" ]]; then
echo "Using cached app list (${cache_age}s old, $current_app_count apps) ✓" >&2 # Only show cache info in debug mode
[[ -n "${MOLE_DEBUG:-}" ]] && echo "Using cached app list (${cache_age}s old, $current_app_count apps) ✓" >&2
echo "$cache_file" echo "$cache_file"
return 0 return 0
fi fi
@@ -122,8 +127,8 @@ scan_applications() {
# Pre-cache current epoch to avoid repeated calls # Pre-cache current epoch to avoid repeated calls
local current_epoch=$(date "+%s") local current_epoch=$(date "+%s")
# Spinner for scanning feedback # Spinner for scanning feedback (simple ASCII for compatibility)
local spinner_chars="⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏" local spinner_chars="|/-\\"
local spinner_idx=0 local spinner_idx=0
# First pass: quickly collect all valid app paths and bundle IDs # First pass: quickly collect all valid app paths and bundle IDs
@@ -289,8 +294,8 @@ scan_applications() {
pids+=($!) pids+=($!)
# Update progress with spinner # Update progress with spinner
local spinner_char="${spinner_chars:$((spinner_idx % 10)):1}" local spinner_char="${spinner_chars:$((spinner_idx % 4)):1}"
echo -ne "\r🗑️ ${spinner_char} Scanning... $app_count/$total_apps" >&2 echo -ne "\r\033[K ${spinner_char} Scanning applications... $app_count/$total_apps" >&2
((spinner_idx++)) ((spinner_idx++))
# Wait if we've hit max parallel limit # Wait if we've hit max parallel limit
@@ -305,7 +310,7 @@ scan_applications() {
wait "$pid" 2>/dev/null wait "$pid" 2>/dev/null
done done
echo -e "\r🗑️ ✓ Found $app_count applications " >&2 echo -e "\r\033[K ✓ Found $app_count applications" >&2
echo "" >&2 echo "" >&2
# Check if we found any applications # Check if we found any applications

View File

@@ -37,7 +37,8 @@ select_apps_for_uninstall() {
menu_options+=("$(format_app_display "$display_name" "$size" "$last_used")") menu_options+=("$(format_app_display "$display_name" "$size" "$last_used")")
done done
echo "" # Clear screen before menu (alternate screen preserves main screen)
clear_screen
# Use paginated menu - result will be stored in MOLE_SELECTION_RESULT # Use paginated menu - result will be stored in MOLE_SELECTION_RESULT
MOLE_SELECTION_RESULT="" MOLE_SELECTION_RESULT=""