Fix make_mapping on files with spaces

This commit is contained in:
Varun Patil 2020-10-20 11:55:29 +05:30
parent cc21a7a66c
commit 0f77118c06
1 changed files with 6 additions and 9 deletions

View File

@ -3,23 +3,16 @@
echo "var mapping = {" > mapping.js echo "var mapping = {" > mapping.js
echo "var bitmapSizeMapping = {" > bitmap-map.js echo "var bitmapSizeMapping = {" > bitmap-map.js
for file in {*,*/*,*/**/*} for file in {*,*/*,*/**/*,*/**/**/*}
do do
filename="${file%.*}" filename="${file%.*}"
fl="$(echo "$filename" | tr '[:upper:]' '[:lower:]')" fl="$(echo "$filename" | tr '[:upper:]' '[:lower:]')"
if [ -f $file ] if [ -f "${file}" ]
then then
md5=`md5sum "${file}" | awk '{ print $1 }'` 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` sz=`identify -format "%w,%h" "${file}" 2>/dev/null`
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
convert "$file" -resize 64x64\> "conv.png" convert "$file" -resize 64x64\> "conv.png"
@ -30,8 +23,12 @@ then
echo "\"$fl\": [${sz},\"${duri}\"]," >> bitmap-map.js echo "\"$fl\": [${sz},\"${duri}\"]," >> bitmap-map.js
fi fi
else
md5=''
fi fi
echo "\"$fl\": \"${file}?h=${md5}\"," >> mapping.js
done done
echo "};" >> mapping.js echo "};" >> mapping.js