#!/bin/bash # GUI launcher for macOS: double-click this file in Finder. set -u MODULE_ROOT="$(cd "$(dirname "$0")" && pwd)" PACKED_APP="$MODULE_ROOT/dist/Catalogizer.app" VENV_PYTHON="$MODULE_ROOT/.venv/bin/python3" # A packed build needs neither Python nor PySide6, so it wins when present. if [ -d "$PACKED_APP" ]; then if [ "${1:-}" = "--check" ]; then "$PACKED_APP/Contents/MacOS/Catalogizer" --check exit $? fi open -a "$PACKED_APP" --args "$@" exit 0 fi PYTHON="$VENV_PYTHON" [ -x "$PYTHON" ] || PYTHON="$(command -v python3 || true)" if [ -z "$PYTHON" ] || ! "$PYTHON" -c "import PySide6, pymupdf" >/dev/null 2>&1; then echo "Python with PySide6 and pymupdf is not available." echo echo "Either build a standalone Catalogizer.app with BUILD_APP.command," echo "or install the dependencies:" echo " python3 -m pip install -r \"$MODULE_ROOT/requirements.txt\"" exit 1 fi exec "$PYTHON" "$MODULE_ROOT/catalog_gui.py" "$@"