mirror of
https://github.com/tw93/Mole.git
synced 2026-02-15 11:05:09 +00:00
chore: Do not check if should_protect_path exists
should_protect_path will always be available as it comes from common.sh. This check adds a lot of overhead as it runs on every file.
This commit is contained in:
@@ -197,12 +197,10 @@ safe_find_delete() {
|
|||||||
find_args+=("-mtime" "+$age_days")
|
find_args+=("-mtime" "+$age_days")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Iterate results to respect should_protect_path when available
|
# Iterate results to respect should_protect_path
|
||||||
while IFS= read -r -d '' match; do
|
while IFS= read -r -d '' match; do
|
||||||
if command -v should_protect_path > /dev/null 2>&1; then
|
if should_protect_path "$match"; then
|
||||||
if should_protect_path "$match"; then
|
continue
|
||||||
continue
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
safe_remove "$match" true || true
|
safe_remove "$match" true || true
|
||||||
done < <(command find "$base_dir" "${find_args[@]}" -print0 2> /dev/null || true)
|
done < <(command find "$base_dir" "${find_args[@]}" -print0 2> /dev/null || true)
|
||||||
@@ -241,12 +239,10 @@ safe_sudo_find_delete() {
|
|||||||
find_args+=("-mtime" "+$age_days")
|
find_args+=("-mtime" "+$age_days")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Iterate results to respect should_protect_path when available
|
# Iterate results to respect should_protect_path
|
||||||
while IFS= read -r -d '' match; do
|
while IFS= read -r -d '' match; do
|
||||||
if command -v should_protect_path > /dev/null 2>&1; then
|
if should_protect_path "$match"; then
|
||||||
if should_protect_path "$match"; then
|
continue
|
||||||
continue
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
safe_sudo_remove "$match" || true
|
safe_sudo_remove "$match" || true
|
||||||
done < <(sudo find "$base_dir" "${find_args[@]}" -print0 2> /dev/null || true)
|
done < <(sudo find "$base_dir" "${find_args[@]}" -print0 2> /dev/null || true)
|
||||||
|
|||||||
Reference in New Issue
Block a user