Use -n/-z in if conditions where possible

This commit is contained in:
Margen67 2022-03-09 20:56:47 -08:00
parent c5052c05a1
commit 67a70b4235
7 changed files with 9 additions and 9 deletions

View File

@ -10,7 +10,7 @@ cd $basedir
if [[ "$OSTYPE" == "cygwin" || "$OSTYPE" == "msys" ]]; then
# Patch version.h
if [[ "$OPENRCT2_BUILD" != "" ]]; then
if [[ -n "$OPENRCT2_BUILD" ]]; then
echo -e "\033[0;36mPatching version.h...\033[0m"
fileversion=$OPENRCT2_VERSION.$OPENRCT2_BUILD
productversion="$fileversion-${OPENRCT2_SHA1_SHORT}"

View File

@ -17,7 +17,7 @@ if [[ "$1" == "-i" ]]; then
fi
basedir="$(readlink -f `dirname $0`/..)"
if [[ "$output" == "" ]]; then
if [[ -z "$output" ]]; then
mkdir -p "$basedir/artifacts"
output="$basedir/artifacts/openrct2-installer-$CONFIGURATION-$PLATFORM.exe"
fi

View File

@ -1,7 +1,7 @@
#!/bin/bash -ex
# use RAM disk if possible
if [ "$CI" == "" ] && [ -d /dev/shm ]; then
if [ -z "$CI" ] && [ -d /dev/shm ]; then
TEMP_BASE=/dev/shm
else
TEMP_BASE=/tmp
@ -15,7 +15,7 @@ cleanup () {
fi
}
if [ "$NO_CLEANUP" == "" ] && trap cleanup EXIT
if [ -z "$NO_CLEANUP" ] && trap cleanup EXIT
# store repo root as variable
REPO_ROOT=$(readlink -f $(dirname "$0")/../..)

View File

@ -34,7 +34,7 @@ else
export OPENRCT2_PUSH=true
fi
fi
if [[ "$OPENRCT2_ORG_TOKEN" == "" ]]; then
if [[ -z "$OPENRCT2_ORG_TOKEN" ]]; then
unset OPENRCT2_PUSH
fi

View File

@ -11,7 +11,7 @@ fi
path=$1
if [ "$BACKTRACE_IO_TOKEN" == "" ]; then
if [ -z "$BACKTRACE_IO_TOKEN" ]; then
echo -e "\033[0;31mBACKTRACE_IO_TOKEN not set"
exit 1
fi

View File

@ -71,13 +71,13 @@ case "$flavour" in
exit 1
esac
if [ "$branch" != "" ]; then
if [ -n "$branch" ]; then
versionextra=-$branch-${sha1:0:7}
fi
filename=OpenRCT2-$version$versionextra-$flavour
echo -e "\033[0;36mUploading to openrct2.org as '$filename'..."
if [ "$OPENRCT2_ORG_TOKEN" == "" ]; then
if [ -z "$OPENRCT2_ORG_TOKEN" ]; then
echo -e "\033[0;31mOPENRCT2_ORG_TOKEN not set"
exit 1
fi

View File

@ -120,7 +120,7 @@ if $cygwin ; then
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
if [ -n "$GRADLE_CYGPATTERN" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh