mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 19:40:07 +00:00
refactor(base): extract get_lsregister_path as shared utility
Move get_lsregister_path() to base.sh to avoid duplication across optimize and uninstall modules. Adds macOS 14+ compatibility with fallback paths.
This commit is contained in:
@@ -43,6 +43,27 @@ readonly ICON_NAV_UP="↑"
|
||||
readonly ICON_NAV_DOWN="↓"
|
||||
readonly ICON_INFO="ℹ"
|
||||
|
||||
# ============================================================================
|
||||
# LaunchServices Utility
|
||||
# ============================================================================
|
||||
|
||||
# Locate the lsregister binary (path varies across macOS versions).
|
||||
get_lsregister_path() {
|
||||
local -a candidates=(
|
||||
"/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister"
|
||||
"/System/Library/CoreServices/Frameworks/LaunchServices.framework/Support/lsregister"
|
||||
)
|
||||
local candidate=""
|
||||
for candidate in "${candidates[@]}"; do
|
||||
if [[ -x "$candidate" ]]; then
|
||||
echo "$candidate"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
echo ""
|
||||
return 0
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# Global Configuration Constants
|
||||
# ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user