Skip to content

Commit

Permalink
updateConfigEntry: Move declaration for ESCAPED_CFGVALUE
Browse files Browse the repository at this point in the history
Need to move it until after we map CFGVALUE booleans
so that ESCAPED_CFGVALUE contains the final updated
CFGVALUE.
  • Loading branch information
sonic2kk committed Mar 24, 2024
1 parent 9b1f9a8 commit 61bb84b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions steamtinkerlaunch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
PREFIX="/usr"
PROGNAME="SteamTinkerLaunch"
NICEPROGNAME="Steam Tinker Launch"
PROGVERS="v14.0.20240324-1 (updateConfigEntry-escpae-incoming-cfgvalue)"
PROGVERS="v14.0.20240324-2 (updateConfigEntry-escpae-incoming-cfgvalue)"
PROGCMD="${0##*/}"
PROGINTERNALPROTNAME="Proton-stl"
SHOSTL="stl"
Expand Down Expand Up @@ -10921,7 +10921,6 @@ function createDefaultCfgs {
function updateConfigEntry {
CFGCAT="$1"
CFGVALUE="$2"
ESCAPED_CFGVALUE="$( printf "%s" "$CFGVALUE" | sed 's/\\/\\\\/g' )" # Help prevent expanding incoming config values by escaping them (i.e. when using with sed)
CFGFILE="$3"

if [ "$CFGCAT" == "CUSTOMCMD" ] && [ "$CFGFILE" == "$STLDEFGAMECFG" ]; then
Expand All @@ -10946,6 +10945,9 @@ function updateConfigEntry {
CFGVALUE=""
fi

# Help prevent expanding incoming config values by escaping them (i.e. when using with sed)
ESCAPED_CFGVALUE="$( printf "%s\n" "$CFGVALUE" | sed 's/\\/\\\\/g' )"

# only save value if it changed
# sed needs escaped string because otherwise it'll expand escape sequences in strings with backslashes
# i.e. config values with Windows paths, '\home\test' will have '\t' expanded as a tab character
Expand Down

0 comments on commit 61bb84b

Please sign in to comment.