Datasets:
File size: 1,242 Bytes
41dfd8d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #!/usr/bin/env bash
#
# Launch script for the "tmpNote" macOS app.
#
# tmpNote is a menu-bar (LSUIElement) application: when it starts it adds an
# icon to the system status bar rather than opening a normal window or showing
# a Dock icon. `open -W` keeps this launcher in the foreground until the app is
# quit from its menu.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
APP_NAME="tmpNote.app"
# Search the likely locations, in order:
# 1. $APP_OUTPUT_DIR (where build.sh was told to place the app)
# 2. next to this script (build.sh default output)
# 3. inside the derived-data build directory produced by build.sh
CANDIDATES=(
"${APP_OUTPUT_DIR:-$SCRIPT_DIR}/$APP_NAME"
"$SCRIPT_DIR/$APP_NAME"
"$SCRIPT_DIR/build_dd/Build/Products/Release/$APP_NAME"
)
APP_PATH=""
for c in "${CANDIDATES[@]}"; do
if [ -d "$c" ]; then
APP_PATH="$c"
break
fi
done
if [ -z "$APP_PATH" ]; then
echo "ERROR: could not find $APP_NAME. Run build.sh first." >&2
echo "Looked in:" >&2
printf ' %s\n' "${CANDIDATES[@]}" >&2
exit 1
fi
echo "==> Launching $APP_PATH"
# -W waits until the (menu-bar) app terminates; --args forwards any extra flags.
exec open -W "$APP_PATH" --args "$@"
|