Skip to content

Commit 7e78a67

Browse files
committed
Add Godot wrapper script
To ease running Godot from the command line, provide a wrapper script that looks for common Godot executables. As an escape hatch, the `GODOT` environment variable can be used to set exactly how Godot should be executed. This is very Linux-centric with only `godot` or the Godot Flatpak supported, but it can be extended as needed.
1 parent af3acb7 commit 7e78a67

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

scripts/godot.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# Wrapper script to try to execute the Godot binary.
4+
set -e
5+
6+
get_godot_bin() {
7+
# GODOT environment variable preferred.
8+
if [ -n "$GODOT" ]; then
9+
echo "$GODOT"
10+
return 0
11+
fi
12+
13+
# godot in PATH.
14+
if type -p godot >/dev/null; then
15+
echo godot
16+
return 0
17+
fi
18+
19+
# Flatpak Godot with <installation>/exports/bin in PATH.
20+
if type -p org.godotengine.Godot >/dev/null; then
21+
echo org.godotengine.Godot
22+
return 0
23+
fi
24+
25+
# Flatpak Godot without <installation>/exports/bin in PATH.
26+
if flatpak info org.godotengine.Godot &>/dev/null; then
27+
echo "flatpak run org.godotengine.Godot"
28+
return 0
29+
fi
30+
31+
echo "error: Could not find godot executable, set GODOT environment variable" >&2
32+
return 1
33+
}
34+
35+
godot_bin=$(get_godot_bin)
36+
exec $godot_bin "$@"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy