chore: make local Godot start script portable

This commit is contained in:
torsten 2026-11-10 15:49:51 +01:00
parent b5b1e0dbf7
commit de4ff8cae7

View file

@ -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" "$@"