diff --git a/Allwmake b/Allwmake index 2e570c89a5313460edffed0c561d9dc52cac2267..36d7658f196692f6035341ca8be0778555b6689f 100755 --- a/Allwmake +++ b/Allwmake @@ -1,13 +1,12 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -if [ "$PWD" != "$WM_PROJECT_DIR" ] -then +wmakeCheckPwd "$WM_PROJECT_DIR" || { echo "Error: Current directory is not \$WM_PROJECT_DIR" echo " The environment variables are inconsistent with the installation." echo " Check the OpenFOAM entries in your dot-files and source them." exit 1 -fi +} # wmake is required for subsequent targets ( cd wmake/src && make ) diff --git a/applications/Allwmake b/applications/Allwmake index ddb5b116fc0c49c641464033034ee6c470880bd0..48e66941d301219c4d5d73f1ce9e8b3c584602de 100755 --- a/applications/Allwmake +++ b/applications/Allwmake @@ -1,13 +1,12 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -if [ "$PWD" != "$WM_PROJECT_DIR/applications" ] -then +wmakeCheckPwd "$WM_PROJECT_DIR/applications" || { echo "Error: Current directory is not \$WM_PROJECT_DIR/applications" echo " The environment variables are inconsistent with the installation." echo " Check the OpenFOAM entries in your dot-files and source them." exit 1 -fi +} set -x diff --git a/src/Allwmake b/src/Allwmake index 1fcbb76d3330a76f749f0c80dc7fe6f675f6eda2..ebef2d8d0d1f0a6915ceaa414c1792351e3e5624 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -1,13 +1,12 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -if [ "$PWD" != "$WM_PROJECT_DIR/src" ] -then +wmakeCheckPwd "$WM_PROJECT_DIR/src" || { echo "Error: Current directory is not \$WM_PROJECT_DIR/src" echo " The environment variables are inconsistent with the installation." echo " Check the OpenFOAM entries in your dot-files and source them." exit 1 -fi +} set -x diff --git a/bin/foamCheckPwd b/wmake/wmakeCheckPwd similarity index 88% rename from bin/foamCheckPwd rename to wmake/wmakeCheckPwd index 1da6f1a84daa6b00106dcac4e499da341448f358..48266543faa39818ada320105b68ace0b4d32474 100755 --- a/bin/foamCheckPwd +++ b/wmake/wmakeCheckPwd @@ -24,7 +24,7 @@ # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # Script -# foamCheckPwd +# wmakeCheckPwd # # Description # Check that the current working directory is equal to a particular @@ -80,19 +80,24 @@ done dirName="$1" -# trival checks first +# trivial checks first [ "$PWD" = "$dirName" ] && exit 0 -[ -d "$dirName" ] || exit 1 + +[ -d "$dirName" ] || { + [ "$quietOpt" = true ] || echo "Error: Directory does not exist $dirName" + exit 1 +} # use /bin/pwd to get the absolute path (could be linked) thisDir=$(/bin/pwd) -dirName=$(cd $dirName 2>/dev/null && /bin/pwd) +target=$(cd $dirName 2>/dev/null && /bin/pwd) # okay -[ "$thisDir" = "$dirName" ] && exit 0 +[ "$thisDir" = "$target" ] && exit 0 # some other error +[ "$quietOpt" = true ] || echo "Error: Current directory is not $dirName" exit 1 #------------------------------------------------------------------------------