changeset 151:a40c94b57602

renamed x; create png directory if doesn't exist
author Adrianna Pińska <adrianna.pinska@gmail.com>
date Tue, 13 Sep 2011 19:00:57 +0200
parents 4eb3aed07065
children 8502e422cefc
files scripts/make_pngs.sh
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/make_pngs.sh	Tue Sep 13 18:58:01 2011 +0200
+++ b/scripts/make_pngs.sh	Tue Sep 13 19:00:57 2011 +0200
@@ -8,11 +8,13 @@
 svgroot=source/svg
 pngroot=data
 
-for x in `find $svgroot -name "*.svg"`
+for sourcepath in `find $svgroot -name "*.svg"`
 do
-    sourcefile=`basename $x`
-    sourcedir=`dirname $x`
-    destpath=${sourcedir/#$svgroot/$pngroot}/${sourcefile/%svg/png}
-    rsvg-convert $x -w $tilesize -h $tilesize -o $destpath
+    sourcefile=`basename $sourcepath`
+    sourcedir=`dirname $sourcepath`
+    destdir=${sourcedir/#$svgroot/$pngroot}
+    mkdir -p $destdir
+    destpath=$destdir/${sourcefile/%svg/png}
+    rsvg-convert $sourcepath -w $tilesize -h $tilesize -o $destpath
     pngcrush -q $destpath tmp && mv tmp $destpath
 done