From 5b9aa31553f3457d71530965e49a84cca17c92c9 Mon Sep 17 00:00:00 2001 From: Eamonn Rea Date: Mon, 30 Sep 2024 03:19:15 +0100 Subject: [PATCH] lang: Don't create global config in `loadLanguage` Don't attempt to save and load the global config in `loadLanguage` unless it exists. Prevents `loadLanguage`, which is called very early, from creating the global config before `setSteamPaths` has a chance to define some paths that are needed to create the global config. Most notably, this fixes Luxtorpeda and Roberta variables from being incorrect when created too early by `loadLanguage`, as this function creates the global config before `setSteamPaths` has a chance to define `STEAMCOMPATOOLS` which is needed in order to build a valid path for `LUXTORPEDACMD` and `ROBERTACMD`. --- steamtinkerlaunch | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/steamtinkerlaunch b/steamtinkerlaunch index 4a432e72..9fd64366 100755 --- a/steamtinkerlaunch +++ b/steamtinkerlaunch @@ -7,7 +7,7 @@ PREFIX="/usr" PROGNAME="SteamTinkerLaunch" NICEPROGNAME="Steam Tinker Launch" -PROGVERS="v14.0.20240903-2" +PROGVERS="v14.0.20240930-1 (dont-create-globalconfig-paths-without-steamvars)" PROGCMD="${0##*/}" PROGINTERNALPROTNAME="Proton-stl" SHOSTL="stl" @@ -2696,8 +2696,13 @@ function loadLanguage { writelog "INFO" "${FUNCNAME[0]} - First load the default language '$STLDEFLANG' to make sure all variables are filled" loadLangFile "$STLDEFLANG" - saveCfg "$STLDEFGLOBALCFG" X - loadCfg "$STLDEFGLOBALCFG" X + # Prevents loadLanguage from creating the global.conf too early when it may be missing values + # i.e. loadLanguage may be called before setSteamPaths, which can result in creating paths without the required Steam path variables set yet + # This can happen with Luxtorpead, where the LUXTORPEDACMD may be written out before `setSteamPaths` has been called to set `STEAMCOMPATTOOL` + if [ -f "$STLDEFGLOBALCFG" ]; then + saveCfg "$STLDEFGLOBALCFG" X + loadCfg "$STLDEFGLOBALCFG" X + fi writelog "INFO" "${FUNCNAME[0]} - Loading STLLANG from '$STLDEFGLOBALCFG'"