Skip to content

Commit 878c64c

Browse files
authored
run.sh: Update SteamLaunch with a futureproof version
1 parent c73bf3f commit 878c64c

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

assets/nix/run.sh

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,34 @@ corlib_dir=""
6767

6868
# Special case: program is launched via Steam
6969
# In that case rerun the script via their bootstrapper to ensure Steam overlay works
70-
if [ "$2" = "SteamLaunch" ]; then
71-
steam="$1 $2 $3 $4 $0 $5"
72-
shift 5
73-
$steam "$@"
74-
exit
75-
fi
70+
for a in "$@"; do
71+
case "$a" in
72+
SteamLaunch)
73+
rotated=0; max=$#
74+
while [ $rotated -lt $max ]; do
75+
case "$1" in
76+
*$executable_name)
77+
to_rotate=$(($# - rotated))
78+
set -- "$@" "$0"
79+
while [ $((to_rotate-=1)) -ge 0 ]; do
80+
set -- "$@" "$1"
81+
shift
82+
done
83+
exec "$@"
84+
;;
85+
*)
86+
set -- "$@" "$1"
87+
shift
88+
rotated=$((rotated+1))
89+
;;
90+
esac
91+
done
92+
exit 1
93+
;;
94+
*)
95+
;;
96+
esac
97+
done
7698

7799
# Handle first param being executable name
78100
if [ -x "$1" ] ; then

0 commit comments

Comments
 (0)