README.md edited online with Bitbucket
[swg-src.git] / utils / build_tab_multi.sh
blob12b8702fe7d75b0cc67ab66380c25b8060eb36d2
1 #!/bin/bash
3 server=$(find ./dsrc/sku.0/sys.server/compiled/game/datatables -name '*.tab')
4 inc=$(find ./dsrc/sku.0/sys.shared/compiled/game/datatables/include -name '*.tab')
5 shared=$(find ./dsrc/sku.0/sys.shared/compiled/game/datatables -name '*.tab')
7 filenames=("${server[@]}" "${inc[@]}" "${shared[@]}")
9 spinstr='|/-\'
10 i=0
11 current=0
12 total=$(ls ${filenames[@]} | wc -l)
14 compile () {
15 ofilename=${filename/dsrc/data}
16 ofilename=${ofilename/.tab/.iff}
17 mkdir -p $(dirname $ofilename)
19 [ -e $ofilename ] && rm "$ofilename"
21 result=$(./exe/linux/bin/DataTableTool -i "$filename" -- -s SharedFile searchPath10=data/sku.0/sys.shared/compiled/game searchPath10=data/sku.0/sys.server/compiled/game 2>&1)
23 if [[ ! $result =~ .*SUCCESS.* ]]; then
24 printf "\r$filename\n"
25 printf "$result\n\n"
29 for filename in ${filenames[@]}; do
30 current=$((current+1))
31 i=$(( (i+1) %4 ))
32 perc=$(bc -l <<< "scale=0; $current*100/$total")
33 printf "\rGenerating Datatables: [${spinstr:$i:1}] $perc%%"
34 while [ `jobs | wc -l` -ge 20 ]
36 sleep 5
37 done
38 compile $filename & done
39 wait
41 echo ""