mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 18:30:08 +00:00
fix(optimize): use ICON constants and improve LaunchServices path detection
- Replace Unicode characters with ICON_SUCCESS and ICON_INFO constants - Add fallback paths for lsregister tool (macOS 14+ compatibility)
This commit is contained in:
@@ -14,7 +14,7 @@ opt_msg() {
|
|||||||
if [[ "${MOLE_DRY_RUN:-0}" == "1" ]]; then
|
if [[ "${MOLE_DRY_RUN:-0}" == "1" ]]; then
|
||||||
echo -e " ${YELLOW}${ICON_DRY_RUN}${NC} $message"
|
echo -e " ${YELLOW}${ICON_DRY_RUN}${NC} $message"
|
||||||
else
|
else
|
||||||
echo -e " ${GREEN}✓${NC} $message"
|
echo -e " ${GREEN}${ICON_SUCCESS}${NC} $message"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -406,9 +406,20 @@ opt_launch_services_rebuild() {
|
|||||||
start_inline_spinner ""
|
start_inline_spinner ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local lsregister="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister"
|
local lsregister=""
|
||||||
|
local -a lsregister_candidates=(
|
||||||
|
"/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister"
|
||||||
|
"/System/Library/CoreServices/Frameworks/LaunchServices.framework/Support/lsregister"
|
||||||
|
)
|
||||||
|
local lsregister_candidate=""
|
||||||
|
for lsregister_candidate in "${lsregister_candidates[@]}"; do
|
||||||
|
if [[ -x "$lsregister_candidate" ]]; then
|
||||||
|
lsregister="$lsregister_candidate"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
if [[ -f "$lsregister" ]]; then
|
if [[ -n "$lsregister" ]]; then
|
||||||
local success=0
|
local success=0
|
||||||
|
|
||||||
if [[ "${MOLE_DRY_RUN:-0}" != "1" ]]; then
|
if [[ "${MOLE_DRY_RUN:-0}" != "1" ]]; then
|
||||||
@@ -741,7 +752,7 @@ opt_spotlight_index_optimize() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${MOLE_DRY_RUN:-0}" != "1" ]]; then
|
if [[ "${MOLE_DRY_RUN:-0}" != "1" ]]; then
|
||||||
echo -e " ${BLUE}ℹ${NC} Spotlight search is slow, rebuilding index, may take 1-2 hours"
|
echo -e " ${BLUE}${ICON_INFO}${NC} Spotlight search is slow, rebuilding index, may take 1-2 hours"
|
||||||
if sudo mdutil -E / > /dev/null 2>&1; then
|
if sudo mdutil -E / > /dev/null 2>&1; then
|
||||||
opt_msg "Spotlight index rebuild started"
|
opt_msg "Spotlight index rebuild started"
|
||||||
echo -e " ${GRAY}Indexing will continue in background${NC}"
|
echo -e " ${GRAY}Indexing will continue in background${NC}"
|
||||||
|
|||||||
Reference in New Issue
Block a user