From 0f77118c06577c4cc660ba6b9b728ecd34a0fe0a Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Tue, 20 Oct 2020 11:55:29 +0530 Subject: [PATCH] Fix make_mapping on files with spaces --- extra/make_mapping.sh | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/extra/make_mapping.sh b/extra/make_mapping.sh index f929c6a..29cce7a 100755 --- a/extra/make_mapping.sh +++ b/extra/make_mapping.sh @@ -3,23 +3,16 @@ echo "var mapping = {" > mapping.js echo "var bitmapSizeMapping = {" > bitmap-map.js -for file in {*,*/*,*/**/*} +for file in {*,*/*,*/**/*,*/**/**/*} do filename="${file%.*}" fl="$(echo "$filename" | tr '[:upper:]' '[:lower:]')" -if [ -f $file ] +if [ -f "${file}" ] then md5=`md5sum "${file}" | awk '{ print $1 }'` -else - md5='' -fi -echo "\"$fl\": \"${file}?h=${md5}\"," >> mapping.js - -if [ -f $file ] -then sz=`identify -format "%w,%h" "${file}" 2>/dev/null` if [ $? -eq 0 ]; then convert "$file" -resize 64x64\> "conv.png" @@ -30,8 +23,12 @@ then echo "\"$fl\": [${sz},\"${duri}\"]," >> bitmap-map.js fi +else + md5='' fi +echo "\"$fl\": \"${file}?h=${md5}\"," >> mapping.js + done echo "};" >> mapping.js