#!/bin/bash

# I need inkscape!
if [[ `which inkscape` == "" ]]; then
	echo "This script needs inkscape!"
else
# -- Wrapper --

wdir="${PWD%/}"
odir="${PWD}%/"

# Check for directory
if [ -d "${1}" ]; then
	cd "${1}"
	odir="${PWD}"
	cd "${wdir}"
else
	echo "No valid directory specified..."
fi

# Announce directories
echo "Working dir is: $wdir"
echo "Output dir is:  $odir"

# Execute
cd "SVG"
for svg in *.svg;
	do
	inkscape "${wdir}/SVG/${svg}" --export-png="${odir}/${svg%.*}.png"
	done;
	
# -- Wrapper --
fi
