1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 20:50:06 +00:00

fix: harden orphan cleanup and lsregister fallback

This commit is contained in:
tw93
2026-03-08 15:29:25 +08:00
parent 50efe51565
commit 26b267c4a2
4 changed files with 77 additions and 1 deletions

View File

@@ -261,6 +261,17 @@ is_claude_vm_bundle_orphaned() {
return 1
fi
if [[ -e "$vm_bundle_path" ]]; then
local last_modified_epoch
last_modified_epoch=$(get_file_mtime "$vm_bundle_path")
local current_epoch
current_epoch=$(get_epoch_seconds)
local days_since_modified=$(((current_epoch - last_modified_epoch) / 86400))
if [[ $days_since_modified -lt ${ORPHAN_AGE_THRESHOLD:-60} ]]; then
return 1
fi
fi
if [[ -z "$ORPHAN_MDFIND_CACHE_FILE" ]]; then
ORPHAN_MDFIND_CACHE_FILE=$(mktemp "${TMPDIR:-/tmp}/mole_mdfind_cache.XXXXXX")
register_temp_file "$ORPHAN_MDFIND_CACHE_FILE"