From f21a1339a70cc123bc15a61712ca5140767a31f4 Mon Sep 17 00:00:00 2001 From: Jack Phallen Date: Sun, 4 Jan 2026 21:33:39 -0500 Subject: [PATCH] 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. --- lib/core/file_ops.sh | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/core/file_ops.sh b/lib/core/file_ops.sh index 23a9463..1c8c046 100644 --- a/lib/core/file_ops.sh +++ b/lib/core/file_ops.sh @@ -197,12 +197,10 @@ safe_find_delete() { find_args+=("-mtime" "+$age_days") fi - # Iterate results to respect should_protect_path when available + # Iterate results to respect should_protect_path while IFS= read -r -d '' match; do - if command -v should_protect_path > /dev/null 2>&1; then - if should_protect_path "$match"; then - continue - fi + if should_protect_path "$match"; then + continue fi safe_remove "$match" true || 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") fi - # Iterate results to respect should_protect_path when available + # Iterate results to respect should_protect_path while IFS= read -r -d '' match; do - if command -v should_protect_path > /dev/null 2>&1; then - if should_protect_path "$match"; then - continue - fi + if should_protect_path "$match"; then + continue fi safe_sudo_remove "$match" || true done < <(sudo find "$base_dir" "${find_args[@]}" -print0 2> /dev/null || true)