#!/usr/bin/env bash # Launch the stable hoxay app (macOS). # # Idempotent: `open` activates the already-running app. The app is a normal # macOS bundle in ~/Applications — Finder, Spotlight, `open -a hoxay`, the # Dock and this script all reach the same installed copy. No bridge, port or # browser is involved. set -euo pipefail HERE="$(cd "$(dirname "$0")" && pwd)" # shellcheck source=components/hoxay/common.sh . "$HERE/common.sh" migrate_legacy_state_dir STATE_DIR="$(state_dir)" APPS_DIR="$(apps_dir)" CURRENT_FILE="$STATE_DIR/current" APP_FILE="$STATE_DIR/current_app" [[ -f "$CURRENT_FILE" ]] || die "no install found ($CURRENT_FILE missing); run install.sh first" name="$(cat "$CURRENT_FILE")" release="$STATE_DIR/releases/$name" app="" if [[ -f "$APP_FILE" ]]; then recorded="$(cat "$APP_FILE")" if [[ -d "$recorded" ]]; then app="$recorded" fi fi if [[ -z "$app" ]]; then # Fall back to the app this release staged. built="$(built_app_of "$release")" if [[ -n "$built" ]]; then candidate="$APPS_DIR/$(basename "$built")" if [[ -d "$candidate" ]]; then app="$candidate" fi fi fi [[ -n "$app" ]] || die "installed app missing for $name; run install.sh" [[ -x "$(app_executable_path "$app")" ]] || die "app executable missing: $app" open "$app" log "launched $name ($app)"