summaryrefslogblamecommitdiff
path: root/tools/edit-map-tileset-names.sh
blob: 6c359e29313b455e90e64f61f1d3b9d1e9b6ec52 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                     
#!/bin/bash
for MAP in maps/*.tmx
do
    grep '<tileset\|<image' "$MAP" |
        while read TILESET && read IMAGE
        do
            LINE=$TILESET
            TILESET=${TILESET#*name=\"}
            TILESET=${TILESET%%\"*}
            IMAGE=${IMAGE#*source=\"}
            IMAGE=${IMAGE%%.png\"*}
            IMAGE=${IMAGE##*/}
            sed "/$LINE/s/$TILESET/$IMAGE/" -i "$MAP"
        done
done