Ensure that xml files exist in lint dirs

This commit is contained in:
Price Hiller 2022-01-01 03:19:33 -06:00
parent c2d6438f2e
commit ead238fd60

View File

@ -272,13 +272,15 @@ start_server() {
lint_dirs=("${server_directory}" "${server_directory}/Saves") lint_dirs=("${server_directory}" "${server_directory}/Saves")
if which xmllint >/dev/null 2>&1; then if which xmllint >/dev/null 2>&1; then
for dir in "${lint_dirs[@]}"; do for dir in "${lint_dirs[@]}"; do
for xml_file in "${dir}"/*.xml; do if ls "${dir}"/*.xml >/dev/null 2>&1; then
log "info" "Linting $(important "${xml_file}")" for xml_file in "${dir}"/*.xml; do
if ! xmllint "${xml_file}" >/dev/null; then log "info" "Linting $(important "${xml_file}")"
log "error" "Xml parsing error in $(important "${xml_file}"), resolve the error and attempt to start again" if ! xmllint "${xml_file}" >/dev/null; then
return 1 log "error" "Xml parsing error in $(important "${xml_file}"), resolve the error and attempt to start again"
fi return 1
done fi
done
fi
done done
else else
log "warning" "$(important "xmllint") not installed or not in PATH, skipping lint check" log "warning" "$(important "xmllint") not installed or not in PATH, skipping lint check"