build: double quote args and wrap in brace expansions (#1105)

This commit is contained in:
Frazer Smith
2022-06-05 20:30:23 +01:00
committed by GitHub
parent 31355417a8
commit 98d30bdc2c
14 changed files with 95 additions and 95 deletions

View File

@@ -8,9 +8,9 @@ set -e
check_programs() {
for arg in "$@"
do
if ! command -v $arg >/dev/null 2>&1
if ! command -v "${arg}" >/dev/null 2>&1
then
echo "$arg could not be found"
echo "${arg} could not be found"
exit
fi
done
@@ -22,22 +22,22 @@ SRC_PREFIX=""
VSCODE_PREFIX=""
build_darwin_types() {
for file in ${VSCODE_PREFIX}vscode/resources/darwin/*
for file in "${VSCODE_PREFIX}"vscode/resources/darwin/*
do
if [ -f "$file" ]; then
name=$(basename $file '.icns')
if [ -f "${file}" ]; then
name=$(basename "${file}" '.icns')
if [[ $name != 'code' ]] && [ ! -f "${SRC_PREFIX}src/resources/darwin/$name.icns" ]; then
icns2png -x -s 512x512 $file -o .
if [[ ${name} != 'code' ]] && [ ! -f "${SRC_PREFIX}src/resources/darwin/${name}.icns" ]; then
icns2png -x -s 512x512 "${file}" -o .
composite -blend 100% -geometry +323+365 icons/corner_512.png "${name}_512x512x32.png" "$name.png"
composite icons/code_darwin.png "$name.png" "$name.png"
composite -blend 100% -geometry +323+365 icons/corner_512.png "${name}_512x512x32.png" "${name}.png"
composite icons/code_darwin.png "${name}.png" "${name}.png"
convert "$name.png" -resize 256x256 "${name}_256.png"
convert "${name}.png" -resize 256x256 "${name}_256.png"
png2icns "${SRC_PREFIX}src/resources/darwin/$name.icns" "$name.png" "${name}_256.png"
png2icns "${SRC_PREFIX}src/resources/darwin/${name}.icns" "${name}.png" "${name}_256.png"
rm "${name}_512x512x32.png" "$name.png" "${name}_256.png"
rm "${name}_512x512x32.png" "${name}.png" "${name}_256.png"
fi
fi
done
@@ -56,17 +56,17 @@ build_darwin_main() {
}
build_win32() {
for file in ${VSCODE_PREFIX}vscode/resources/win32/*.ico
for file in "${VSCODE_PREFIX}"vscode/resources/win32/*.ico
do
if [ -f "$file" ]; then
name=$(basename $file '.ico')
if [ -f "${file}" ]; then
name=$(basename "${file}" '.ico')
if [[ $name != 'code' ]] && [ ! -f "${SRC_PREFIX}src/resources/win32/$name.ico" ]; then
icotool -x -w 256 $file
if [[ ${name} != 'code' ]] && [ ! -f "${SRC_PREFIX}src/resources/win32/${name}.ico" ]; then
icotool -x -w 256 "${file}"
composite -geometry +150+185 icons/code_64.png "${name}_9_256x256x32.png" "${name}.png"
convert "${name}.png" -define icon:auto-resize=256,128,96,64,48,32,24,20,16 "${SRC_PREFIX}src/resources/win32/$name.ico"
convert "${name}.png" -define icon:auto-resize=256,128,96,64,48,32,24,20,16 "${SRC_PREFIX}src/resources/win32/${name}.ico"
rm "${name}_9_256x256x32.png" "${name}.png"
fi
@@ -144,7 +144,7 @@ build_win32() {
fi
}
if [ "$0" == "$BASH_SOURCE" ];
if [ "${0}" == "${BASH_SOURCE}" ];
then
build_darwin_types
build_win32