File: levelconvert.sh

package info (click to toggle)
pingus 0.7.6-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,672 kB
  • sloc: cpp: 42,080; xml: 2,319; lisp: 521; ruby: 455; ansic: 365; objc: 248; sh: 247; makefile: 140; python: 15
file content (45 lines) | stat: -rwxr-xr-x 897 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash

set -e

function errmsg() {
    echo "ERROR: Critical failure :ERROR"
}

trap errmsg ERR

if [ ! \( -d "data/levels" \) ]; then
    echo "You must call this script from the top level Pingus directory"
    exit 1
fi

for IN in "$@"; do
    TMP=$(tempfile)
    OUT="${IN}"
    OUT="${OUT%%.xml}"
    OUT="${OUT%%.plf}"    
    OUT="${OUT}.pingus"
    # echo "Prefix: $PREFIX"
    echo "IN:     $IN"
    echo "OUT:    $OUT"
    echo "TMP:    $TMP"
    if true; then
        xsltproc \
            -o "$TMP" \
            tools/pingusv1tov2.xsl \
            "$IN"
        tools/xml2sexpr.rb "$TMP" "$IN" > "${OUT}"        
    else
        xalan \
            -indent 0 \
            -xsl tools/pingusv1tov2.xsl \
            -in "$IN" \
            -out "$TMP"
        tools/xml2sexpr.rb "$TMP" "$IN" > "${OUT}"
    fi
    # rm "$TMP"
    echo "Conversion ok"
    echo ""
done

# EOF #