From 5a9b188b38b8c1d4ed532cd132273958e6a3ffc1 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sat, 1 Jan 2022 02:48:53 -0600 Subject: [PATCH] bash expansion for xml linting --- Scripts/7D2D-Manage.bash | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/Scripts/7D2D-Manage.bash b/Scripts/7D2D-Manage.bash index 0b78ef8..eb15f1a 100644 --- a/Scripts/7D2D-Manage.bash +++ b/Scripts/7D2D-Manage.bash @@ -152,17 +152,6 @@ important() { echo_rgb "${1}" 135 195 255 } -xml_lint_dir() { - - for xml_file in "${1}"/*.xml; do - log "info" "Linting $(important "${xml_file}")" - if ! xmllint "${xml_file}" >/dev/null; then - log "error" "Xml parsing error in $(important "${xml_file}"), resolve the error and attempt to start again" - return 1 - fi - done - -} start_server() { local server_id local can_kill @@ -280,11 +269,13 @@ start_server() { # xmllint, helps avoiding the random server launch failures for apparently no reason if which xmllint >/dev/null 2>&1; then - if ! xml_lint_dir "${server_directory}"; then - return 1 - elif ! xml_lint_dir "${server_directory}/Saves/"; then - return 1 - fi + for xml_file in "${server_directory}"/{*,"Saves"}.xml; do + log "info" "Linting $(important "${xml_file}")" + if ! xmllint "${xml_file}" >/dev/null; then + log "error" "Xml parsing error in $(important "${xml_file}"), resolve the error and attempt to start again" + return 1 + fi + done else log "warning" "$(important "xmllint") not installed or not in PATH, skipping lint check" fi