#!/usr/bin/env bash # # Launch script for massCode. # Locates the built .app bundle relative to this script and runs it, passing # through any command-line arguments. # set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" APP_NAME="massCode.app" # Candidate locations, in priority order. CANDIDATES=() [ -n "${APP_OUTPUT_DIR:-}" ] && CANDIDATES+=("$APP_OUTPUT_DIR/$APP_NAME") CANDIDATES+=( "$SCRIPT_DIR/$APP_NAME" "$SCRIPT_DIR/dist/mac/$APP_NAME" "$SCRIPT_DIR/dist/mac-arm64/$APP_NAME" "$SCRIPT_DIR/dist/mac-universal/$APP_NAME" ) APP="" for c in "${CANDIDATES[@]}"; do if [ -d "$c" ]; then APP="$c"; break; fi done # Fallback: search the dist tree. if [ -z "$APP" ] && [ -d "$SCRIPT_DIR/dist" ]; then APP="$(find "$SCRIPT_DIR/dist" -maxdepth 2 -name "$APP_NAME" -type d -print -quit 2>/dev/null || true)" fi if [ -z "$APP" ] || [ ! -d "$APP" ]; then echo "!! $APP_NAME not found. Run build.sh first." >&2 exit 1 fi BIN="$APP/Contents/MacOS/massCode" if [ ! -x "$BIN" ]; then echo "!! Executable not found at $BIN" >&2 exit 1 fi echo ">> Launching: $APP" # Run the Electron binary directly (foreground) so logs are visible and args # are passed through. The bundle is self-contained; no extra runtime env needed. exec "$BIN" --force-renderer-accessibility "$@"