mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-20 01:46:13 +00:00
run_bepinex*.sh: support older Steam and paths that contain spaces
This commit is contained in:
1 parent
c82fc4e686
commit
49015217f3
2 files changed
+44
-6
No files matched your search
@@ -65,9 +65,28 @@ corlib_dir="dotnet"
|
||||
# Special case: program is launched via Steam
|
||||
# In that case rerun the script via their bootstrapper to ensure Steam overlay works
|
||||
if [ "$2" = "SteamLaunch" ]; then
|
||||
steam="$1 $2 $3 $4 $5 $6 $0 $7"
|
||||
shift 7
|
||||
exec $steam "$@"
|
||||
# Conceptually: exec "$1" "$2" "$3" "$4" "$0" "rest of $@"
|
||||
# But newer versions of Steam interleave the $1..$4 with some "--" arguments, so preserve them as well
|
||||
# Bash has array subscripting, but POSIX sh doesn't, so avoid it
|
||||
to_rotate=4
|
||||
rotated=0
|
||||
while [ $((to_rotate-=1)) -ge 0 ]; do
|
||||
while [ "z$1" = "z--" ]; do
|
||||
set -- "$@" "$1"
|
||||
shift
|
||||
rotated=$((rotated+1))
|
||||
done
|
||||
set -- "$@" "$1"
|
||||
shift
|
||||
rotated=$((rotated+1))
|
||||
done
|
||||
to_rotate=$(($# - rotated))
|
||||
set -- "$@" "$0"
|
||||
while [ $((to_rotate-=1)) -ge 0 ]; do
|
||||
set -- "$@" "$1"
|
||||
shift
|
||||
done
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Handle first param being executable name
|
||||
|
||||
@@ -65,9 +65,28 @@ corlib_dir=""
|
||||
# Special case: program is launched via Steam
|
||||
# In that case rerun the script via their bootstrapper to ensure Steam overlay works
|
||||
if [ "$2" = "SteamLaunch" ]; then
|
||||
steam="$1 $2 $3 $4 $5 $6 $0 $7"
|
||||
shift 7
|
||||
exec $steam "$@"
|
||||
# Conceptually: exec "$1" "$2" "$3" "$4" "$0" "rest of $@"
|
||||
# But newer versions of Steam interleave the $1..$4 with some "--" arguments, so preserve them as well
|
||||
# Bash has array subscripting, but POSIX sh doesn't, so avoid it
|
||||
to_rotate=4
|
||||
rotated=0
|
||||
while [ $((to_rotate-=1)) -ge 0 ]; do
|
||||
while [ "z$1" = "z--" ]; do
|
||||
set -- "$@" "$1"
|
||||
shift
|
||||
rotated=$((rotated+1))
|
||||
done
|
||||
set -- "$@" "$1"
|
||||
shift
|
||||
rotated=$((rotated+1))
|
||||
done
|
||||
to_rotate=$(($# - rotated))
|
||||
set -- "$@" "$0"
|
||||
while [ $((to_rotate-=1)) -ge 0 ]; do
|
||||
set -- "$@" "$1"
|
||||
shift
|
||||
done
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Handle first param being executable name
|
||||
|
||||
Reference in new issue
Block a user