Commit bdbdd25b authored by Mark Olesen's avatar Mark Olesen
Browse files

Allwmake and {applications,src}/Allwmake use wmake/wmakeCheckPwd

- solves problems that can occur when checking $PWD and links are involved
parent 1d8294b5
#!/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 )
......
#!/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
......
#!/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
......
......@@ -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
#------------------------------------------------------------------------------
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment