Skip to content

Commit 9c16298

Browse files
committed
TOOLS: Handle Windows backslashes in map WAD paths
1 parent 26dac33 commit 9c16298

4 files changed

Lines changed: 85 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Verify .MAP files Conform to Standard
2+
on: [pull_request]
3+
jobs:
4+
PCX-Conformity:
5+
name: Verify .MAP files Conform to Standard
6+
runs-on: ubuntu-latest
7+
container:
8+
image: ubuntu:24.04
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Wait for GitHub to keep up..
13+
run: sleep 2s
14+
shell: bash
15+
- name: Run Script
16+
run: |
17+
bash testing/map_validator.sh

testing/map_validator.sh

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
#
3+
# Nazi Zombies: Portable
4+
# Validate that .MAP files conform to standards.
5+
# ----
6+
# This is intended to be used via a Docker
7+
# container running ubuntu:24.04.
8+
#
9+
set -o errexit
10+
11+
ASSETS_ROOT=$(dirname "${BASH_SOURCE[0]}")/../
12+
cd "${ASSETS_ROOT}"
13+
14+
#
15+
# test_no_backslashes_in_wad_paths()
16+
# ----
17+
# Ensures there are no backslashes in
18+
# a .MAP's WAD paths, caused by Windows.
19+
#
20+
function test_no_backslashes_in_wad_paths()
21+
{
22+
echo "[INFO]: Ensuring no .MAP files use backslashes in their WAD paths.."
23+
echo ""
24+
cd "${ASSETS_ROOT}/source/maps"
25+
26+
local old_ifs=${IFS}
27+
local found_bad_file="0"
28+
29+
# Iterate through every .map in our source..
30+
while read -r map_file; do
31+
echo "[INFO]: Verifying [${map_file}].."
32+
33+
if grep "\"wad\"" "${map_file}" | grep -q '\\'; then
34+
echo "[ERROR]: Found backslash in \"wad\" key. Please update to use forward slashes."
35+
echo ""
36+
found_bad_file="1"
37+
fi
38+
done < <(find . -type f -name "*.map")
39+
40+
echo ""
41+
42+
if [[ "${found_bad_file}" -ne "0" ]]; then
43+
exit 1
44+
fi
45+
46+
echo ""
47+
echo ""
48+
echo ""
49+
}
50+
51+
#
52+
# main()
53+
# ----
54+
# Test entry point.
55+
#
56+
function main()
57+
{
58+
test_no_backslashes_in_wad_paths;
59+
60+
echo "[PASS]: No issues found :)"
61+
exit 0
62+
}
63+
64+
main;

testing/wad_texture_conformity.sh

100644100755
File mode changed.

tools/compile-maps.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ function compile_individual_level()
9292

9393
cd "source/maps/${pretty_name}"
9494

95+
# Grrr..... Windows....
96+
# Swap backslashes in wad key with forward slashes
97+
sed -i '/^"wad"/ s|\\|/|g' ${pretty_name}.map
98+
9599
# 1. hlcsg
96100
command="../../../tools/vhlt/hlcsg ${HLCSG_PARMS} ${hlcsg_args} ${pretty_name}.map"
97101
echo "[${command}]"

0 commit comments

Comments
 (0)