Small improvements to scenario validation script

- Now works for paths containing spaces
- No longer deletes the scenario/ folder if the scenario was already called that
This commit is contained in:
2016-09-16 23:46:09 -04:00
parent 6fd346ef16
commit 4e9117035d

View File

@@ -24,31 +24,35 @@ function check-file {
xmllint --nonet --noout --schema "$BOE_SCHEMAS_DIR/$1.xsd" "$2" xmllint --nonet --noout --schema "$BOE_SCHEMAS_DIR/$1.xsd" "$2"
} }
check-file scenario "$SCEN_PATH/scenario.xml" cd "$SCEN_PATH"
check-file terrain "$SCEN_PATH/terrain.xml"
check-file items "$SCEN_PATH/items.xml" check-file scenario "scenario.xml"
check-file monsters "$SCEN_PATH/monsters.xml" check-file terrain "terrain.xml"
check-file items "items.xml"
check-file monsters "monsters.xml"
shopt -s nullglob shopt -s nullglob
for sector in $SCEN_PATH/out/out*.xml; do for sector in out/out*.xml; do
check-file outdoor "$sector" check-file outdoor "$sector"
done done
for town in $SCEN_PATH/towns/town*.xml; do for town in towns/town*.xml; do
check-file town "$town" check-file town "$town"
done done
for speech in $SCEN_PATH/towns/talk*.xml; do for speech in towns/talk*.xml; do
check-file dialogue "$speech" check-file dialogue "$speech"
done done
if [[ -d $SCEN_PATH/dialogs/ ]]; then if [[ -d dialogs/ ]]; then
for dlog in $SCEN_PATH/dialogs/*.xml; do for dlog in dialogs/*.xml; do
check-file dialog "$dlog" check-file dialog "$dlog"
done done
fi fi
if [[ $SCEN_PATH = scenario ]]; then cd ..
if [[ $SCEN_PATH = scenario && ${1##*/} != scenario ]]; then
rm -rf scenario rm -rf scenario
fi fi