mirror of
https://github.com/tw93/Mole.git
synced 2026-02-07 01:55:36 +00:00
feat: optimize application scanning performance, improve multi-selection robustness
This commit is contained in:
@@ -486,28 +486,6 @@ should_protect_path() {
|
||||
local path="$1"
|
||||
[[ -z "$path" ]] && return 1
|
||||
|
||||
# 0. Check custom protected paths first
|
||||
local custom_config="$HOME/.config/mole/protected_paths"
|
||||
if [[ -f "$custom_config" ]]; then
|
||||
while IFS= read -r protected_path; do
|
||||
# Trim whitespace
|
||||
protected_path="${protected_path#"${protected_path%%[![:space:]]*}"}"
|
||||
protected_path="${protected_path%"${protected_path##*[![:space:]]}"}"
|
||||
|
||||
# Skip empty lines and comments
|
||||
[[ -z "$protected_path" || "$protected_path" =~ ^# ]] && continue
|
||||
|
||||
# Expand ~ to $HOME in protected path
|
||||
protected_path="${protected_path/#\~/$HOME}"
|
||||
|
||||
# Check if path starts with protected path (prefix match)
|
||||
# This protects both the directory and everything under it
|
||||
if [[ "$path" == "$protected_path" || "$path" == "$protected_path"/* ]]; then
|
||||
return 0
|
||||
fi
|
||||
done < "$custom_config"
|
||||
fi
|
||||
|
||||
local path_lower
|
||||
path_lower=$(echo "$path" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ save_whitelist_patterns() {
|
||||
header_text="# Mole Optimization Whitelist - These checks will be skipped during optimization"
|
||||
else
|
||||
config_file="$WHITELIST_CONFIG_CLEAN"
|
||||
header_text="# Mole Whitelist - Protected paths won't be deleted\n# Default protections: Playwright browsers, HuggingFace models, Maven repo, Ollama models, Surge Mac, R renv, Finder metadata\n#\n# Add one pattern per line to keep items safe.\n#\n# You can also add custom paths to protect (e.g., ~/important-project, /opt/myapp):\n# ~/my-project\n# ~/.config/important-app"
|
||||
header_text="# Mole Whitelist - Protected paths won't be deleted\n# Default protections: Playwright browsers, HuggingFace models, Maven repo, Ollama models, Surge Mac, R renv, Finder metadata\n# Add one pattern per line to keep items safe."
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname "$config_file")"
|
||||
|
||||
Reference in New Issue
Block a user