From de4ff8cae7b513c95882d20e1976a59d818757f8 Mon Sep 17 00:00:00 2001 From: torsten Date: Tue, 10 Nov 2026 15:49:51 +0100 Subject: [PATCH] chore: make local Godot start script portable --- start_rinkplanner.sh | 49 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/start_rinkplanner.sh b/start_rinkplanner.sh index bd76193..126903b 100755 --- a/start_rinkplanner.sh +++ b/start_rinkplanner.sh @@ -1 +1,48 @@ -/opt/godot/Godot_v4.7.2-stable_linux.x86_64 --path rinkplanner +#!/usr/bin/env bash +# Startet den Godot-Editor mit dem rinkplanner-Projekt. +# +# Godot wird in dieser Reihenfolge gesucht: +# 1. $GODOT (z. B. GODOT=/pfad/zu/Godot ./start_rinkplanner.sh) +# 2. Linux-Build unter /opt/godot/ +# 3. macOS-App unter /Applications oder ~/Applications +# 4. godot bzw. godot4 im PATH +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_DIR="$REPO_ROOT/rinkplanner" + +find_godot() { + local candidates=( + "${GODOT:-}" + "/opt/godot/Godot_v4.7.2-stable_linux.x86_64" + "/Applications/Godot.app/Contents/MacOS/Godot" + "$HOME/Applications/Godot.app/Contents/MacOS/Godot" + ) + local candidate name + for candidate in "${candidates[@]}"; do + if [[ -n "$candidate" && -x "$candidate" ]]; then + printf '%s\n' "$candidate" + return 0 + fi + done + for name in godot godot4; do + if candidate="$(command -v "$name" 2>/dev/null)"; then + printf '%s\n' "$candidate" + return 0 + fi + done + return 1 +} + +if ! GODOT_BIN="$(find_godot)"; then + echo "Godot nicht gefunden." >&2 + echo "Installiere Godot (macOS: /Applications/Godot.app) oder setze GODOT=/pfad/zu/godot." >&2 + exit 1 +fi + +if [[ ! -f "$PROJECT_DIR/project.godot" ]]; then + echo "Projekt nicht gefunden: $PROJECT_DIR/project.godot" >&2 + exit 1 +fi + +exec "$GODOT_BIN" --path "$PROJECT_DIR" "$@"