From 84f63ba97930676ac9a13a9d45f49fbae1c25da1 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Sat, 28 Jan 2017 17:57:13 +0000 Subject: [PATCH] Allwmake: Provides clearer message when OpenFOAM environment is not loaded Patch contributed by Bruno Santos Resolves patch request https://bugs.openfoam.org/view.php?id=2424 --- Allwmake | 3 ++- applications/Allwmake | 3 ++- src/Allwmake | 3 ++- wmake/scripts/AllwmakeParseArguments | 11 ++++++++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Allwmake b/Allwmake index 67c26d0a3..3f6a7523d 100755 --- a/Allwmake +++ b/Allwmake @@ -2,8 +2,9 @@ cd ${0%/*} || exit 1 # Run from this directory # Parse arguments for library compilation -. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments +. wmake/scripts/AllwmakeParseArguments +# Perform various checks wmakeCheckPwd "$WM_PROJECT_DIR" || { echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR" echo " The environment variables are inconsistent with the installation." diff --git a/applications/Allwmake b/applications/Allwmake index d851254b2..2b725832b 100755 --- a/applications/Allwmake +++ b/applications/Allwmake @@ -2,8 +2,9 @@ cd ${0%/*} || exit 1 # Run from this directory # Parse arguments for library compilation -. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments +. ../wmake/scripts/AllwmakeParseArguments +# Perform various checks wmakeCheckPwd "$WM_PROJECT_DIR/applications" || { echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR/applications" echo " The environment variables are inconsistent with the installation." diff --git a/src/Allwmake b/src/Allwmake index 5e6eedf3f..29d16a152 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -2,8 +2,9 @@ cd ${0%/*} || exit 1 # Run from this directory # Parse arguments for library compilation -. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments +. ../wmake/scripts/AllwmakeParseArguments +# Perform various checks wmakeCheckPwd "$WM_PROJECT_DIR/src" || { echo "Allwmake error: Current directory is not \$WM_PROJECT_DIR/src" echo " The environment variables are inconsistent with the installation." diff --git a/wmake/scripts/AllwmakeParseArguments b/wmake/scripts/AllwmakeParseArguments index a985064ef..0736876ad 100644 --- a/wmake/scripts/AllwmakeParseArguments +++ b/wmake/scripts/AllwmakeParseArguments @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -34,6 +34,15 @@ #------------------------------------------------------------------------------ Script=${0##*/} +if [ -z "$WM_PROJECT_DIR" ] +then + echo "$Script error: The OpenFOAM environment is not set." + echo " Check the OpenFOAM entries in your dot-files and source them." + echo " If in doubt, please read:" + echo " http://openfoam.org/download/source/setting-environment" + exit 1 +fi + usage() { exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done