#!/bin/sh set -eu PROJECT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) for artifact in program.pbx manifest.json assets.pa; do if [ ! -f "$PROJECT_DIR/build/$artifact" ]; then printf '%s\n' "Build this project in Studio Shipper before running it." >&2 exit 1 fi done RUNTIME_PATH=${PROMETEU_RUNTIME:-} if [ -z "$RUNTIME_PATH" ]; then RUNTIME_PATH=$(python3 - "$PROJECT_DIR" <<'CONFIG_PY' import json,sys from pathlib import Path root=Path(sys.argv[1]) setup=root/'.studio/setup.json' try: value=json.loads(setup.read_text()).get('prometeuRuntimePath') if setup.exists() else None except (ValueError,OSError) as error: raise SystemExit('Cannot read project runtime configuration: '+str(error)) print(value or root/'runtime') CONFIG_PY ) fi case "$RUNTIME_PATH" in /*) ;; *) RUNTIME_PATH="$PROJECT_DIR/$RUNTIME_PATH" ;; esac if [ ! -x "$RUNTIME_PATH/prometeu" ]; then printf '%s\n' "Runtime not found: $RUNTIME_PATH/prometeu" "Select it in Studio or set PROMETEU_RUNTIME to its installation directory." >&2 exit 1 fi exec "$RUNTIME_PATH/prometeu" run "$PROJECT_DIR/build"