1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 18:34:46 +00:00

fix: remove unsafe file cleanup in Library root and fix tests

- lib/clean: remove empty file cleanup in ~/Library to protect potential sentinel files
- tests: fix unbound variable error in clean_user_core.bats by initializing WHITELIST_PATTERNS
This commit is contained in:
Tw93
2026-01-14 12:56:38 +08:00
parent 7089ce69d1
commit 8a873c85a3
2 changed files with 1 additions and 16 deletions

View File

@@ -32,23 +32,7 @@ clean_empty_library_items() {
safe_clean "${empty_dirs[@]}" "Empty Library folders"
fi
# Clean empty files in Library root (skipping .localized and other sentinels)
local -a empty_files=()
while IFS= read -r -d '' file; do
[[ -f "$file" ]] || continue
# Protect .localized and potential system sentinels
if [[ "$(basename "$file")" == ".localized" ]]; then
continue
fi
if is_path_whitelisted "$file"; then
continue
fi
empty_files+=("$file")
done < <(find "$HOME/Library" -mindepth 1 -maxdepth 1 -type f -empty -print0 2> /dev/null)
if [[ ${#empty_files[@]} -gt 0 ]]; then
safe_clean "${empty_files[@]}" "Empty Library files"
fi
# 2. Clean empty subdirectories in Application Support and other key locations
# Iteratively remove empty directories until no more are found