mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 13:16:47 +00:00
refactor: optimize raycast cleanup code structure
Improve code readability and maintainability: - Simplify conditional logic with chained operators - Add clarifying comments for different cleanup scopes - Rename variables for better semantic clarity - Maintain consistent style with other app cleanup patterns
This commit is contained in:
@@ -1093,28 +1093,28 @@ find_app_files() {
|
|||||||
|
|
||||||
# 7. Raycast
|
# 7. Raycast
|
||||||
if [[ "$bundle_id" == "com.raycast.macos" ]]; then
|
if [[ "$bundle_id" == "com.raycast.macos" ]]; then
|
||||||
local raycast_parents=(
|
# Standard user directories
|
||||||
|
local raycast_dirs=(
|
||||||
"$HOME/Library/Application Support"
|
"$HOME/Library/Application Support"
|
||||||
"$HOME/Library/Application Scripts"
|
"$HOME/Library/Application Scripts"
|
||||||
"$HOME/Library/Containers"
|
"$HOME/Library/Containers"
|
||||||
)
|
)
|
||||||
for parent in "${raycast_parents[@]}"; do
|
for dir in "${raycast_dirs[@]}"; do
|
||||||
[[ -d "$parent" ]] || continue
|
[[ -d "$dir" ]] && while IFS= read -r -d '' p; do
|
||||||
while IFS= read -r -d '' p; do
|
|
||||||
files_to_clean+=("$p")
|
files_to_clean+=("$p")
|
||||||
done < <(command find "$parent" -maxdepth 1 -type d -iname "*raycast*" -print0 2> /dev/null)
|
done < <(command find "$dir" -maxdepth 1 -type d -iname "*raycast*" -print0 2> /dev/null)
|
||||||
done
|
done
|
||||||
if [[ -d "$HOME/Library/Caches" ]]; then
|
|
||||||
while IFS= read -r -d '' p; do
|
# Cache (deeper search)
|
||||||
|
[[ -d "$HOME/Library/Caches" ]] && while IFS= read -r -d '' p; do
|
||||||
files_to_clean+=("$p")
|
files_to_clean+=("$p")
|
||||||
done < <(command find "$HOME/Library/Caches" -maxdepth 2 -type d -iname "*raycast*" -print0 2> /dev/null)
|
done < <(command find "$HOME/Library/Caches" -maxdepth 2 -type d -iname "*raycast*" -print0 2> /dev/null)
|
||||||
fi
|
|
||||||
local code_storage="$HOME/Library/Application Support/Code/User/globalStorage"
|
# VSCode extension storage
|
||||||
if [[ -d "$code_storage" ]]; then
|
local vscode_global="$HOME/Library/Application Support/Code/User/globalStorage"
|
||||||
while IFS= read -r -d '' p; do
|
[[ -d "$vscode_global" ]] && while IFS= read -r -d '' p; do
|
||||||
files_to_clean+=("$p")
|
files_to_clean+=("$p")
|
||||||
done < <(command find "$code_storage" -maxdepth 1 -type d -iname "*raycast*" -print0 2> /dev/null)
|
done < <(command find "$vscode_global" -maxdepth 1 -type d -iname "*raycast*" -print0 2> /dev/null)
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Output results
|
# Output results
|
||||||
@@ -1210,9 +1210,9 @@ find_app_system_files() {
|
|||||||
done < <(command find /private/var/db/receipts -maxdepth 1 \( -name "*$bundle_id*" \) -print0 2> /dev/null)
|
done < <(command find /private/var/db/receipts -maxdepth 1 \( -name "*$bundle_id*" \) -print0 2> /dev/null)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Raycast system-level (*raycast* under /Library/Application Support)
|
# Raycast system-level files
|
||||||
if [[ "$bundle_id" == "com.raycast.macos" && -d "/Library/Application Support" ]]; then
|
if [[ "$bundle_id" == "com.raycast.macos" ]]; then
|
||||||
while IFS= read -r -d '' p; do
|
[[ -d "/Library/Application Support" ]] && while IFS= read -r -d '' p; do
|
||||||
system_files+=("$p")
|
system_files+=("$p")
|
||||||
done < <(command find "/Library/Application Support" -maxdepth 1 -type d -iname "*raycast*" -print0 2> /dev/null)
|
done < <(command find "/Library/Application Support" -maxdepth 1 -type d -iname "*raycast*" -print0 2> /dev/null)
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user