Change serveradmin.xml to be back in Saves dir

This commit is contained in:
Price Hiller 2022-01-01 02:43:35 -06:00
parent a77535a1d1
commit 18088bbafd

View File

@ -152,6 +152,17 @@ 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
@ -250,10 +261,6 @@ start_server() {
# Override UserDataFolder, opiniated in that it should exist in the Server Directory
elif [[ "${REPLY}" = *"property name=\"UserDataFolder\""* ]]; then
printf "\t%s\n" "<property name=\"UserDataFolder\" value=\"${server_userdata_dir}\" />"
# This is a path RELATIVE to the save game folder, hence we overwrite ../ so it's in the
# base of the server directory
elif [[ "${REPLY}" = *"property name=\"AdminFileName\""* ]]; then
printf "\t%s\n" "<property name=\"AdminFileName\" value=\"../serveradmin.xml\" />"
# Manage the telnet tags
elif [[ "${REPLY}" = *"property name=\"TelnetPort\""* ]]; then
printf "\t%s\n" "<property name=\"TelnetPort\" value=\"${telnet_port}\" />"
@ -273,13 +280,11 @@ start_server() {
# xmllint, helps avoiding the random server launch failures for apparently no reason
if which xmllint >/dev/null 2>&1; then
for xml_file in "${server_directory}"/*.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"
if ! xml_lint_dir "${server_directory}"; then
return 1
elif ! xml_lint_dir "${server_directory}/Saves/"; then
return 1
fi
done
else
log "warning" "$(important "xmllint") not installed or not in PATH, skipping lint check"
fi