From fd43a4f54563dd29d15eb7bcdb3c91d5d1df53e9 Mon Sep 17 00:00:00 2001 From: HybridDog Date: Sun, 17 Jan 2016 17:40:12 +0100 Subject: [PATCH] Abort if minetestmapper isn't found --- mapper.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mapper.sh b/mapper.sh index 9a94721..1e6bd3c 100755 --- a/mapper.sh +++ b/mapper.sh @@ -8,6 +8,14 @@ if [ -z $MAPPERDIR ]; then MAPPERDIR=. fi +mapperpath=$MAPPERDIR/minetestmapper + +if [ ! -f $mapperpath ]; then + echo "Error, "$mapperpath" doesn't exist." + echo "Please specify the path to the minetestmapper executable via the MAPPERDIR variable" + exit 1 +fi + scriptdir=`readlink -f $0` scriptdir=`dirname $scriptdir` @@ -31,7 +39,7 @@ do do posx=$(($spawnx+$tilesize*($x-$tilenum/2))) posy=$(($spawny+$tilesize*($tilenum/2-$y))) - $MAPPERDIR/minetestmapper ${MAPPERPARAMS} -i ${MAPDIR} --geometry ${posx},${posy}+${tilesize}+${tilesize} -o ${tiledir}/20/map_${x}_${y}.png + $mapperpath ${MAPPERPARAMS} -i ${MAPDIR} --geometry ${posx},${posy}+${tilesize}+${tilesize} -o ${tiledir}/20/map_${x}_${y}.png done done @@ -59,4 +67,4 @@ done zoommin=$((20-$zoomlevelnum)) #write the resulting config into a json file -echo "{\"mapsize\":$DIMENSIONS, \"spawn\":{\"x\":$spawnx,\"y\":$spawny}, \"zoommin\":$zoommin}" > $scriptdir/www/conf.json \ No newline at end of file +echo "{\"mapsize\":$DIMENSIONS, \"spawn\":{\"x\":$spawnx,\"y\":$spawny}, \"zoommin\":$zoommin}" > $scriptdir/www/conf.json