Skip to content

Commit

Permalink
lang: Don't create global config in loadLanguage
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
sonic2kk committed Sep 30, 2024
1 parent 4eef095 commit 5b9aa31
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 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.20240903-2"
PROGVERS="v14.0.20240930-1 (dont-create-globalconfig-paths-without-steamvars)"
PROGCMD="${0##*/}"
PROGINTERNALPROTNAME="Proton-stl"
SHOSTL="stl"
Expand Down Expand Up @@ -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'"

Expand Down

0 comments on commit 5b9aa31

Please sign in to comment.