Skip to content

Commit 49850ae

Browse files
authored
fix: escape content added to $command (#23)
hades will no longer pass the unholy `/c=..\"` instead of `/c=..\` funny how this has been the only affected game so far. Fixes #22
1 parent 5a04aca commit 49850ae

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

bin/scopebuddy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set -eo pipefail
1919
##########
2020
# Globals
2121
##########
22-
SCB_VER="1.2.3"
22+
SCB_VER="1.2.4"
2323

2424
gamescope_opts=""
2525
command=""
@@ -407,9 +407,9 @@ while [[ $# -gt 0 ]]; do
407407
shift
408408
# Add remaining args as individually double quoted args (should stop double quoting being a requirement)
409409
while [[ $# -gt 0 ]]; do
410-
# command variable has to be formated like this otherwise the %command% will not launch
410+
# command variable has to be formated like this and $1 has to be escaped otherwise the %command% will not launch
411411
# shellcheck disable=SC2089
412-
command+=" \"$1\""
412+
command+=" \"$(printf "%q" "$1")\""
413413
shift
414414
done
415415

@@ -687,5 +687,5 @@ else
687687
fi
688688
# run pre_command before gamescope gets exec'd. will proceed even if pre_command fails.
689689
pre_command
690-
eval "env -u LD_PRELOAD $GAMESCOPE_BIN $gamescope_opts -- env LD_PRELOAD=$LD_PRELOAD_REAL $command"
690+
eval "env -u LD_PRELOAD $GAMESCOPE_BIN $gamescope_opts -- env LD_PRELOAD=\"$LD_PRELOAD_REAL\" $command"
691691
fi

0 commit comments

Comments
 (0)