Skip to content

Instantly share code, notes, and snippets.

@pohy
Created October 21, 2024 18:38
Show Gist options
  • Save pohy/723e4f552dd8f6b80f7d8d0d9e7094f1 to your computer and use it in GitHub Desktop.
Save pohy/723e4f552dd8f6b80f7d8d0d9e7094f1 to your computer and use it in GitHub Desktop.
Run specific godot version from CLI
#! /bin/sh
# Place into ~/.local/bin/godot, or wherever
# Also adjust GODOT_PATH to taste
VERSION=4.3
REST_ARGS=()
while [ "$1" != "" ]; do
case $1 in
-v | --version)
shift
VERSION=$1
;;
*)
REST_ARGS+=("$1")
;;
esac
shift
done
GODOT_PATH=/Applications/Godot_v$VERSION.app/Contents/MacOS/Godot
if [ -f $GODOT_PATH ]; then
$GODOT_PATH "${REST_ARGS[@]}"
else
echo "Godot v$VERSION not found at $GODOT_PATH" >&2
AVAILBLE_VERSIONS=$(ls /Applications | grep Godot_v | sed 's/Godot_v//g' | sed 's/\.app//g' | sort -n)
echo "Available versions:\n$AVAILBLE_VERSIONS" >&2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment