From 78752b731f7116aa692040b26456bba32b31e122 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 26 Oct 2015 12:58:16 +0100 Subject: [PATCH] manage both svg and svgz Change-Id: I928775c101bed14ef03a4266e5c90279dcc9427a --- src/tools/apply-stylesheet.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/tools/apply-stylesheet.sh b/src/tools/apply-stylesheet.sh index 7fad83062..eb8daf306 100755 --- a/src/tools/apply-stylesheet.sh +++ b/src/tools/apply-stylesheet.sh @@ -173,14 +173,22 @@ if [ -z "$file" ]; exit 1 fi -if [ ! -f $file.svgz ]; then +isSvgz=0 + +if [ ! -f $file.svgz ] && [ ! -f $file.svg ]; then echo "you must specify a valid svg" exit 1 fi +if [ -f $file.svgz ]; then + isSvgz=1 +fi -mv $file.svgz $file.svg.gz -gunzip $file.svg.gz + +if [ $isSvgz = 1 ]; then + mv $file.svgz $file.svg.gz + gunzip $file.svg.gz +fi echo Processing $file @@ -273,5 +281,7 @@ done rm transform.xsl mv temp.svg $file.svg -gzip $file.svg -mv $file.svg.gz $file.svgz +if [ $isSvgz = 1 ]; then + gzip $file.svg + mv $file.svg.gz $file.svgz +fi