From 112b4a6f9db8652b99940c085a5c79020ee2f68b Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 5 Nov 2011 15:21:56 +0000 Subject: [PATCH] Exit with an error if home directory to build in contains a space character. Subversion-branch: /buildscripts Subversion-revision: 2474 --- build-chocolate-doom | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/build-chocolate-doom b/build-chocolate-doom index eeaba81..e3b34a7 100644 --- a/build-chocolate-doom +++ b/build-chocolate-doom @@ -19,6 +19,21 @@ CHOCOLATE_DOOM_DIR=~/chocolate-doom PACKAGES_DIR=$CHOCOLATE_DOOM_DIR/packages BUILD_DIR=$CHOCOLATE_DOOM_DIR/build +# Check if the specified string matches the glob pattern. + +pattern_match() { + pattern="$1" + + case "$2" in + $pattern) + true + ;; + *) + false + ;; + esac +} + # Determine if a given program is in the PATH. have_tool() { @@ -228,6 +243,22 @@ usage() { exit 0 } +if pattern_match "* *" "$HOME"; then + echo + echo "The path to your home directory contains a space:" + echo + echo " HOME=$HOME" + echo + echo "This script will probably fail to build - reset HOME to point" + echo "somewhere else. For example, type:" + echo + echo " mkdir /home/user" + echo " HOME=/home/user" + echo + + exit -1 +fi + if ! have_tool gcc; then echo "No compiler found. Please install gcc!" >&2 exit -1 @@ -300,7 +331,7 @@ fi # Windows build? echo $HOST_ARG -if [ `uname` = "Cygwin" ] || (echo "$HOST_ARG" | grep -q mingw); then +if [ `uname` = "Cygwin" ] || pattern_match "*mingw*" "$HOST_ARG"; then echo echo "Windows build: installing supplementary DirectX headers."