From 63840f2a5f307707f60aec87760039cce6a910c5 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Mon, 28 Aug 2023 23:43:40 +0100 Subject: [PATCH] refactor: remove redundant code and set default branch The commit refactors the code by removing redundant code that sets the branch to "public" if no custom branch is specified. This change simplifies the logic and improves readability. --- lgsm/modules/core_steamcmd.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lgsm/modules/core_steamcmd.sh b/lgsm/modules/core_steamcmd.sh index 6d96a9e6c..5fbd537de 100644 --- a/lgsm/modules/core_steamcmd.sh +++ b/lgsm/modules/core_steamcmd.sh @@ -151,11 +151,6 @@ fn_update_steamcmd_localbuild() { # Uses appmanifest to find local build. localbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3) - # Set branch to public if no custom branch. - if [ -z "${branch}" ]; then - branch="public" - fi - # Checks if localbuild variable has been set. if [ -z "${localbuild}" ]; then fn_print_fail "Checking local build: ${remotelocation}: missing local build info" @@ -178,6 +173,11 @@ fn_update_steamcmd_remotebuild() { find "${HOME}" -type f -name "appinfo.vdf" -exec rm -f {} \; 2> /dev/null fi + # Set branch to public if no custom branch. + if [ -z "${branch}" ]; then + branch="public" + fi + # password for branch not needed to check the buildid remotebuildversion=$(${steamcmdcommand} +login "${steamuser}" "${steampass}" +app_info_update 1 +app_info_print "${appid}" +quit | sed -e '/"branches"/,/^}/!d' | sed -n "/\"${branch}\"/,/}/p" | grep -m 1 buildid | tr -cd '[:digit:]')