#!/usr/bin/env sh set -euo pipefail ROOT="$(cd -- "$(dirname "$0")/.." && pwd)" BIN="$ROOT/bin/img2pdf" # Ensure caches stay local if build is needed. export GOCACHE="${GOCACHE:-$ROOT/.cache/go-build}" export GOMODCACHE="${GOMODCACHE:-$ROOT/.cache/go-mod}" if [ ! -x "$BIN" ]; then echo "Binary not found; building..." "$ROOT/scripts/build.sh" fi # No args: launch UI (Wayland only). if [ "$#" -eq 0 ]; then export FYNE_DRIVER="${FYNE_DRIVER:-wayland}" "$BIN" else "$BIN" "$@" fi