From 729b5d57490810372cb3912a88ff5eb2cc8f7405 Mon Sep 17 00:00:00 2001 From: Goh Jia Hao Date: Sat, 28 May 2016 19:22:32 +0800 Subject: [PATCH] Fix bug where convert script fails silently if dependency is not found --- bin/convertToIcns | 13 ++----------- bin/convertToIco | 7 +------ bin/convertToPng | 14 ++------------ 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/bin/convertToIcns b/bin/convertToIcns index 4681722..cf65190 100755 --- a/bin/convertToIcns +++ b/bin/convertToIcns @@ -13,17 +13,8 @@ set -e CONVERT_TO_PNG="${BASH_SOURCE%/*}/convertToPng" # Exec Paths -ICONUTIL=$(which iconutil) -IMAGEMAGICK_CONVERT=$(which convert) - -if [ ! -x "${ICONUTIL}" ]; then - echo "Cannot find required iconutil executable" >&2 - exit 1; -fi -if [ ! -x "${IMAGEMAGICK_CONVERT}" ]; then - echo "Cannot find required ImageMagick Convert executable" >&2 - exit 1; -fi +type convert >/dev/null 2>&1 || { echo >&2 "Cannot find required ImageMagick Convert executable"; exit 1; } +type iconutil >/dev/null 2>&1 || { echo >&2 "Cannot find required iconutil executable"; exit 1; } # Parameters SOURCE=$1 diff --git a/bin/convertToIco b/bin/convertToIco index 7053755..a0265c8 100755 --- a/bin/convertToIco +++ b/bin/convertToIco @@ -8,12 +8,7 @@ set -e -IMAGEMAGICK_CONVERT=$(which convert) - -if [ ! -x "${IMAGEMAGICK_CONVERT}" ]; then - echo "Cannot find required ImageMagick Convert executable" >&2 - exit 1; -fi +type convert >/dev/null 2>&1 || { echo >&2 "Cannot find required ImageMagick Convert executable"; exit 1; } SOURCE=$1 DEST=$2 diff --git a/bin/convertToPng b/bin/convertToPng index 4ce7668..9f5abb6 100755 --- a/bin/convertToPng +++ b/bin/convertToPng @@ -8,18 +8,8 @@ set -e -# Exec Paths -IMAGEMAGICK_CONVERT=$(which convert) -IMAGEMAGICK_IDENTIFY=$(which identify) - -if [ ! -x "${IMAGEMAGICK_CONVERT}" ]; then - echo "Cannot find required ImageMagick Convert executable" >&2 - exit 1; -fi -if [ ! -x "${IMAGEMAGICK_IDENTIFY}" ]; then - echo "Cannot find required ImageMagick Identify executable" >&2 - exit 1; -fi +type convert >/dev/null 2>&1 || { echo >&2 "Cannot find required ImageMagick Convert executable"; exit 1; } +type identify >/dev/null 2>&1 || { echo >&2 "Cannot find required ImageMagick Identify executable"; exit 1; } # Parameters SOURCE=$1