fix: 兼容 macOS localized 应用安装路径

macOS 安装器可能将应用放入 Ydisks Xianyu Helper.localized 目录,安装脚本改为自动发现普通路径和 localized 路径,避免 postinstall 找不到模板文件。
This commit is contained in:
Christ committed 2026-08-11 23:27:33 +08:00
1 parent 13b57891fb
commit 9cb50a229c
2 files changed
+29 -9

No files matched your search

+15 -1
View File
@@ -9,8 +9,22 @@ printf '\n[%s] postinstall start; uid=%s; user=%s; args=%s\n' \
"$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$(id -u)" "$(id -un)" "$*"
set -x
APP="/Applications/Ydisks Xianyu Helper.app"
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
APP=""
for app_path in \
"/Applications/Ydisks Xianyu Helper.app" \
"/Applications/Ydisks Xianyu Helper.localized/Ydisks Xianyu Helper.app"
do
if [ -f "$app_path/Contents/Info.plist" ]; then
APP="$app_path"
break
fi
done
if [ -z "$APP" ]; then
echo "找不到已安装的 Ydisks Xianyu Helper.app,无法继续注册服务。"
exit 1
fi
SERVER="$APP/Contents/Helpers/xianyu-server"
TRAY="$APP/Contents/MacOS/xianyu-tray"
BROWSER_INSTALL="$APP/Contents/Helpers/browser-install"