1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 17:55:08 +00:00

fix: refresh launchservices after app uninstall

This commit is contained in:
tw93
2026-02-24 14:26:33 +08:00
parent 7dac5dc4e2
commit 258d78991a
2 changed files with 53 additions and 5 deletions

View File

@@ -396,9 +396,9 @@ opt_sqlite_vacuum() {
opt_launch_services_rebuild() {
if [[ "${MO_DEBUG:-}" == "1" ]]; then
debug_operation_start "LaunchServices Rebuild" "Rebuild LaunchServices database"
debug_operation_detail "Method" "Run lsregister -r on system, user, and local domains"
debug_operation_detail "Purpose" "Fix \"Open with\" menu issues and file associations"
debug_operation_detail "Expected outcome" "Correct app associations, fixed duplicate entries"
debug_operation_detail "Method" "Run lsregister -gc then force rescan with -r -f on local, user, and system domains"
debug_operation_detail "Purpose" "Fix \"Open with\" menu issues, file associations, and stale app metadata"
debug_operation_detail "Expected outcome" "Correct app associations, fixed duplicate entries, fewer stale app listings"
debug_risk_level "LOW" "Database is automatically rebuilt"
fi
@@ -413,10 +413,11 @@ opt_launch_services_rebuild() {
if [[ "${MOLE_DRY_RUN:-0}" != "1" ]]; then
set +e
"$lsregister" -r -domain local -domain user -domain system > /dev/null 2>&1
"$lsregister" -gc > /dev/null 2>&1 || true
"$lsregister" -r -f -domain local -domain user -domain system > /dev/null 2>&1
success=$?
if [[ $success -ne 0 ]]; then
"$lsregister" -r -domain local -domain user > /dev/null 2>&1
"$lsregister" -r -f -domain local -domain user > /dev/null 2>&1
success=$?
fi
set -e