Skip to content

Commit 77ca78d

Browse files
Merge #217
217: check.sh: find Godot 4 executable when available as `godot` r=Bromeon a=yannick-was-taken # The Issue Some package managers (Arch Linux) install Godot 4.x as `godot` in the PATH. This is currently not correctly dealt with by check.sh, requiring the user to set GODOT4_BIN manually. # The Solution If `godot` is available, `check.sh` now inspects the version of that Godot installation, and if 4.x, accepts it gladly, removing the need to manually set GODOT4_BIN. # Detail The version check applies the regex `^4\.` to the version returned by `godot --version`. An example version (the one available in Arch Linux's community repo) is `4.0.1.stable.arch_linux`. Co-authored-by: yannick-was-taken <[email protected]>
2 parents 04c2323 + a8a1084 commit 77ca78d

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

check.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ function findGodot() {
7676
echo "Found 'godot4.bat' script"
7777
godotBin="godot4.bat"
7878

79+
# This should come last: only use this as a last resort as usually `godot`
80+
# refers to a Godot 3.x installation.
81+
elif command -v godot &>/dev/null; then
82+
# Check if `godot` actually is Godot 4.x
83+
if godot --version | grep -qE "^4\\."; then
84+
echo "Found 'godot' executable with version $(godot --version)"
85+
godotBin="godot"
86+
else
87+
echo "Found 'godot' executable, but it has the incompatible version $(godot --version)"
88+
exit 2
89+
fi
90+
7991
# Error case
8092
else
8193
echo "Godot executable not found"
@@ -99,7 +111,7 @@ for arg in "${args[@]}"; do
99111
;;
100112
itest)
101113
findGodot
102-
114+
103115
cmds+=("cargo $toolchain build -p itest $extraArgs")
104116
cmds+=("$godotBin --path itest/godot --headless")
105117
;;

0 commit comments

Comments
 (0)