bash expansion for xml linting

This commit is contained in:
Price Hiller 2022-01-01 02:48:53 -06:00
parent 18088bbafd
commit 5a9b188b38

View File

@ -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