File tree Expand file tree Collapse file tree 2 files changed +44
-6
lines changed
Expand file tree Collapse file tree 2 files changed +44
-6
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,28 @@ corlib_dir="dotnet"
6565# Special case: program is launched via Steam
6666# In that case rerun the script via their bootstrapper to ensure Steam overlay works
6767if [ " $2 " = " SteamLaunch" ]; then
68- steam=" $1 $2 $3 $4 $5 $6 $0 $7 "
69- shift 7
70- exec $steam " $@ "
68+ # Conceptually: exec "$1" "$2" "$3" "$4" "$0" "rest of $@"
69+ # But newer versions of Steam interleave the $1..$4 with some "--" arguments, so preserve them as well
70+ # Bash has array subscripting, but POSIX sh doesn't, so avoid it
71+ to_rotate=4
72+ rotated=0
73+ while [ $(( to_rotate-= 1 )) -ge 0 ]; do
74+ while [ " z$1 " = " z--" ]; do
75+ set -- " $@ " " $1 "
76+ shift
77+ rotated=$(( rotated+ 1 ))
78+ done
79+ set -- " $@ " " $1 "
80+ shift
81+ rotated=$(( rotated+ 1 ))
82+ done
83+ to_rotate=$(( $# - rotated))
84+ set -- " $@ " " $0 "
85+ while [ $(( to_rotate-= 1 )) -ge 0 ]; do
86+ set -- " $@ " " $1 "
87+ shift
88+ done
89+ exec " $@ "
7190fi
7291
7392# Handle first param being executable name
Original file line number Diff line number Diff line change @@ -65,9 +65,28 @@ corlib_dir=""
6565# Special case: program is launched via Steam
6666# In that case rerun the script via their bootstrapper to ensure Steam overlay works
6767if [ " $2 " = " SteamLaunch" ]; then
68- steam=" $1 $2 $3 $4 $5 $6 $0 $7 "
69- shift 7
70- exec $steam " $@ "
68+ # Conceptually: exec "$1" "$2" "$3" "$4" "$0" "rest of $@"
69+ # But newer versions of Steam interleave the $1..$4 with some "--" arguments, so preserve them as well
70+ # Bash has array subscripting, but POSIX sh doesn't, so avoid it
71+ to_rotate=4
72+ rotated=0
73+ while [ $(( to_rotate-= 1 )) -ge 0 ]; do
74+ while [ " z$1 " = " z--" ]; do
75+ set -- " $@ " " $1 "
76+ shift
77+ rotated=$(( rotated+ 1 ))
78+ done
79+ set -- " $@ " " $1 "
80+ shift
81+ rotated=$(( rotated+ 1 ))
82+ done
83+ to_rotate=$(( $# - rotated))
84+ set -- " $@ " " $0 "
85+ while [ $(( to_rotate-= 1 )) -ge 0 ]; do
86+ set -- " $@ " " $1 "
87+ shift
88+ done
89+ exec " $@ "
7190fi
7291
7392# Handle first param being executable name
You can’t perform that action at this time.
0 commit comments