Browse Source

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.
pull/4298/head
Daniel Gibbs 2 years ago
parent
commit
63840f2a5f
  1. 10
      lgsm/modules/core_steamcmd.sh

10
lgsm/modules/core_steamcmd.sh

@ -151,11 +151,6 @@ fn_update_steamcmd_localbuild() {
# Uses appmanifest to find local build. # Uses appmanifest to find local build.
localbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3) 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. # Checks if localbuild variable has been set.
if [ -z "${localbuild}" ]; then if [ -z "${localbuild}" ]; then
fn_print_fail "Checking local build: ${remotelocation}: missing local build info" 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 find "${HOME}" -type f -name "appinfo.vdf" -exec rm -f {} \; 2> /dev/null
fi 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 # 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:]') 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:]')

Loading…
Cancel
Save