#!/usr/bin/env bash # # launch.sh — Start FSNotes.app. # # Locates the app relative to this script (so it works on any machine without # build.sh having been sourced) and launches it. FSNotes is a self-contained # .app bundle: all dylibs/frameworks are embedded and found via @rpath, so no # DYLD_* environment variables are required. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" APP_NAME="FSNotes.app" # Search, in order: # 1. $APP_OUTPUT_DIR (if the pipeline exported it) # 2. next to this script (where build.sh copies the app by default) # 3. the Xcode build-products directory used by build.sh CANDIDATES=( "${APP_OUTPUT_DIR:-}/$APP_NAME" "$SCRIPT_DIR/$APP_NAME" "$SCRIPT_DIR/build/Build/Products/Release/$APP_NAME" "$SCRIPT_DIR/build/Build/Products/Debug/$APP_NAME" ) APP_PATH="" for c in "${CANDIDATES[@]}"; do if [ -n "$c" ] && [ -d "$c" ]; then APP_PATH="$c" break fi done if [ -z "$APP_PATH" ]; then echo "ERROR: $APP_NAME not found. Run build.sh first." >&2 echo "Looked in:" >&2 for c in "${CANDIDATES[@]}"; do [ -n "$c" ] && echo " $c" >&2; done exit 1 fi echo "==> Launching $APP_PATH" # -W waits until the app exits; pass any extra args through to the app. exec open -W "$APP_PATH" --args "$@"