Commit 1025c3c4 authored by Mark Olesen's avatar Mark Olesen
Browse files

eliminate .OpenFOAM-VERSION references in dotFoam and other files

parent 3bbd01eb
......@@ -80,27 +80,25 @@ $ECHO "Choose running method: 1)gdb+xterm 2)gdb 3)log 4)xterm+valgrind: \c"
read method
if [ "$method" -ne 1 -a "$method" -ne 2 -a "$method" -ne 3 -a "$method" -ne 4 ]; then
printUsage
exit 1
exit 1
fi
$ECHO "Run all processes local or distributed? 1)local 2)remote: \c"
read spawn
if [ "$spawn" -ne 1 -a "$spawn" -ne 2 ]; then
printUsage
exit 1
exit 1
fi
# check ~/.OpenFOAM-VERSION
# check <site>/etc
# check <site>/.OpenFOAM-VERSION
# check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/
# check <installedProject>/etc/
if [ "$WM_PROJECT" ]; then
: ${FOAM_DOT_DIR:=.$WM_PROJECT-$WM_PROJECT_VERSION}
for i in \
$HOME/$FOAM_DOT_DIR \
$HOME/.WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.WM_PROJECT \
$WM_PROJECT_DIR/etc \
$WM_PROJECT_DIR/$FOAM_DOT_DIR \
;
do
if [ -f "$i/bashrc" ]; then
......@@ -112,7 +110,12 @@ fi
# Construct test string for remote execution.
# Source OpenFOAM settings if OpenFOAM environment not set.
sourceFoam='[ "$WM_PROJECT" ] || . '"$sourceFoam"
# attempt to preserve the installation directory 'FOAM_INST_DIR'
if [ "$FOAM_INST_DIR" ]; then
sourceFoam='[ "$WM_PROJECT" ] || '"FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam"
else
sourceFoam='[ "$WM_PROJECT" ] || '". $sourceFoam"
fi
echo "**sourceFoam:$sourceFoam"
......
......@@ -213,25 +213,13 @@ bool Foam::chDir(const fileName& dir)
Foam::fileName Foam::dotFoam(const fileName& name)
{
// Search for file 'name' in:
// 1) ~/.OpenFOAM-VERSION/, ~/.OpenFOAM/VERSION/ or ~/.OpenFOAM/
// 2) $WM_PROJECT_INST_DIR/site/VERSION or $WM_PROJECT_INST_DIR/site/
// 3) $WM_PROJECT_DIR/etc/
// Search user files:
// ~~~~~~~~~~~~~~~~~~
// Check for user file in ~/.OpenFOAM-VERSION/
fileName fullName = home()/(word(".OpenFOAM-") + FOAMversion)/name;
if (exists(fullName))
{
return fullName;
}
fileName searchDir = home()/".OpenFOAM";
if (dir(searchDir))
{
// Check for user file in ~/.OpenFOAM/VERSION
fullName = searchDir/FOAMversion/name;
fileName fullName = searchDir/FOAMversion/name;
if (exists(fullName))
{
return fullName;
......@@ -252,7 +240,7 @@ Foam::fileName Foam::dotFoam(const fileName& name)
if (dir(searchDir))
{
// Check for site file in $WM_PROJECT_INST_DIR/site/VERSION
fullName = searchDir/"site"/FOAMversion/name;
fileName fullName = searchDir/"site"/FOAMversion/name;
if (exists(fullName))
{
return fullName;
......@@ -272,14 +260,14 @@ Foam::fileName Foam::dotFoam(const fileName& name)
if (dir(searchDir))
{
// Check for shipped OpenFOAM file in $WM_PROJECT_DIR/etc
fullName = searchDir/"etc"/name;
fileName fullName = searchDir/"etc"/name;
if (exists(fullName))
{
return fullName;
}
}
// Nothing found
// Not found
return fileName::null;
}
......
......@@ -89,8 +89,6 @@ bool chDir(const fileName& dir);
//- Search for @em name in the following hierarchy:
// -# personal settings:
// - ~/.OpenFOAM-\<VERSION\>
// <em>(old style)</em>
// - ~/.OpenFOAM/\<VERSION\>/
// <em>for version-specific files</em>
// - ~/.OpenFOAM/
......
......@@ -37,7 +37,8 @@
# Sources the relevant cshrc/bashrc if not set.
#
# WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been set
# before calling this routine
# before calling this routine.
# FOAM_INST_DIR may possibly have been set (to find installation)
#
# Usage
# wmakeScheduler COMMAND
......@@ -45,7 +46,7 @@
#
# wmakeScheduler -count
# count the total number of slots available in WM_HOSTS
# eg, WM_NCOMPPROCS=$(wmakeScheduler -count)
# eg, export WM_NCOMPPROCS=$(wmakeScheduler -count)
#
#-------------------------------------------------------------------------------
lockDir=$HOME/.wmakeScheduler
......@@ -81,35 +82,40 @@ case $SHELL in
;;
esac
# check ~/.$WM_PROJECT-$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/
# check <installedProject>/etc/
# check <installedProject/.$WM_PROJECT-$WM_PROJECT_VERSION/
if [ "$WM_PROJECT" ]; then
: ${FOAM_DOT_DIR:=.$WM_PROJECT-$WM_PROJECT_VERSION}
for i in \
$HOME/$FOAM_DOT_DIR \
$HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.$WM_PROJECT \
$WM_PROJECT_DIR/etc \
$WM_PROJECT_DIR/$FOAM_DOT_DIR \
;
do
if [ -f "$i/$shellRc" ]; then
sourceFoam="$i/$shellRc"
break
fi
done
for i in \
$HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.$WM_PROJECT \
$WM_PROJECT_DIR/etc \
;
do
if [ -f "$i/$shellRc" ]; then
sourceFoam="$i/$shellRc"
break
fi
done
fi
# Construct test string for remote execution.
# Source WM_PROJECT settings if WM_PROJECT environment not set.
# attempt to preserve the installation directory 'FOAM_INST_DIR'
case $sourceFoam in
*/cshrc) sourceFoam='if ( ! $?WM_PROJECT ) source '"$sourceFoam";;
*/bashrc) sourceFoam='[ "$WM_PROJECT" ] || . '"$sourceFoam";;
*/bashrc)
if [ "$FOAM_INST_DIR" ]; then
sourceFoam='[ "$WM_PROJECT" ] || '"FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam"
else
sourceFoam='[ "$WM_PROJECT" ] || '". $sourceFoam"
fi
;;
*/cshrc)
# TODO: csh equivalent to bash code (preserving FOAM_INST_DIR)
sourceFoam='if ( ! $?WM_PROJECT ) source '"$sourceFoam"
;;
esac
# quote double-quotes for remote command line
......@@ -160,7 +166,7 @@ do
if lockfile -r0 "$lockFile" 2>/dev/null; then
# Set colour
colour=${colours[$colourIndex]}
#echo "** host=$host colourIndex=$colourIndex colour=$colour"
## echo "** host=$host colourIndex=$colourIndex colour=$colour"
if [ "$host" = "$HOST" ]; then
if [ "$colour" ]; then
......
......@@ -37,7 +37,8 @@
# Sources the relevant cshrc/bashrc if not set.
#
# WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been set
# before calling this routine
# before calling this routine.
# FOAM_INST_DIR may possibly have been set (to find installation)
#
# Usage
# wmakeScheduler COMMAND
......@@ -45,7 +46,7 @@
#
# wmakeScheduler -count
# count the total number of slots available in WM_HOSTS
# eg, WM_NCOMPPROCS=$(wmakeScheduler -count)
# eg, export WM_NCOMPPROCS=$(wmakeScheduler -count)
#
#-------------------------------------------------------------------------------
lockDir=$HOME/.wmakeScheduler
......@@ -81,21 +82,15 @@ case $SHELL in
;;
esac
# check ~/.$WM_PROJECT-$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/
# check <installedProject>/etc/
# check <installedProject/.$WM_PROJECT-$WM_PROJECT_VERSION/
if [ "$WM_PROJECT" ]; then
: ${FOAM_DOT_DIR:=.$WM_PROJECT-$WM_PROJECT_VERSION}
for i in \
$HOME/$FOAM_DOT_DIR \
$HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.$WM_PROJECT \
$WM_PROJECT_DIR/etc \
$WM_PROJECT_DIR/$FOAM_DOT_DIR \
;
do
if [ -f "$i/$shellRc" ]; then
......@@ -203,7 +198,7 @@ do
fi
done
done
# Not found any free slots. Rest a bit.
# Did not find any free slots. Rest a bit.
sleep 1
done
......
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