From 075396d1716ddbc3c454869239aca8fe1538ed99 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Sun, 24 Mar 2024 04:34:18 +0000 Subject: [PATCH] updateConfigEntry: Move declaration for ESCAPED_CFGVALUE Need to move it until after we map CFGVALUE booleans so that ESCAPED_CFGVALUE contains the final updated CFGVALUE. --- steamtinkerlaunch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index c0f4c02c..837ac235 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -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" @@ -10896,7 +10896,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 @@ -10921,6 +10920,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