#!/bin/bash set -euo pipefail cd "$(dirname "$0")" if ! command -v node >/dev/null 2>&1; then echo "未找到 Node.js。请先安装 Node.js 20+:https://nodejs.org/" echo read -r -p "按回车退出…" _ exit 1 fi if [ -d node_modules ] && [ -d node_modules/electron/dist ] && [ ! -d node_modules/electron/dist/Electron.app ]; then echo "检测到非 macOS 的 Electron 依赖,重新安装…" rm -rf node_modules fi if [ ! -d node_modules ]; then echo "首次运行,安装依赖…" npm install fi if [ ! -f resources/bin/luatos-cli ]; then echo "下载 luatos-cli…" npm run fetch:cli fi npm start