eliminate .OpenFOAM-VERSION references in dotFoam and other files

This commit is contained in:
Mark Olesen
2008-06-16 10:39:22 +02:00
parent 3bbd01ebfb
commit 1025c3c4d3
5 changed files with 49 additions and 59 deletions

View File

@ -90,17 +90,15 @@ if [ "$spawn" -ne 1 -a "$spawn" -ne 2 ]; then
exit 1 exit 1
fi fi
# check ~/.OpenFOAM-VERSION # check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
# check <site>/etc # check ~/.$WM_PROJECT/
# check <site>/.OpenFOAM-VERSION # check <installedProject>/etc/
if [ "$WM_PROJECT" ]; then if [ "$WM_PROJECT" ]; then
: ${FOAM_DOT_DIR:=.$WM_PROJECT-$WM_PROJECT_VERSION}
for i in \ for i in \
$HOME/$FOAM_DOT_DIR \ $HOME/.WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.WM_PROJECT \
$WM_PROJECT_DIR/etc \ $WM_PROJECT_DIR/etc \
$WM_PROJECT_DIR/$FOAM_DOT_DIR \
; ;
do do
if [ -f "$i/bashrc" ]; then if [ -f "$i/bashrc" ]; then
@ -112,7 +110,12 @@ fi
# Construct test string for remote execution. # Construct test string for remote execution.
# Source OpenFOAM settings if OpenFOAM environment not set. # 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" echo "**sourceFoam:$sourceFoam"

View File

@ -213,25 +213,13 @@ bool Foam::chDir(const fileName& dir)
Foam::fileName Foam::dotFoam(const fileName& name) 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: // 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"; fileName searchDir = home()/".OpenFOAM";
if (dir(searchDir)) if (dir(searchDir))
{ {
// Check for user file in ~/.OpenFOAM/VERSION // Check for user file in ~/.OpenFOAM/VERSION
fullName = searchDir/FOAMversion/name; fileName fullName = searchDir/FOAMversion/name;
if (exists(fullName)) if (exists(fullName))
{ {
return fullName; return fullName;
@ -252,7 +240,7 @@ Foam::fileName Foam::dotFoam(const fileName& name)
if (dir(searchDir)) if (dir(searchDir))
{ {
// Check for site file in $WM_PROJECT_INST_DIR/site/VERSION // 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)) if (exists(fullName))
{ {
return fullName; return fullName;
@ -272,14 +260,14 @@ Foam::fileName Foam::dotFoam(const fileName& name)
if (dir(searchDir)) if (dir(searchDir))
{ {
// Check for shipped OpenFOAM file in $WM_PROJECT_DIR/etc // Check for shipped OpenFOAM file in $WM_PROJECT_DIR/etc
fullName = searchDir/"etc"/name; fileName fullName = searchDir/"etc"/name;
if (exists(fullName)) if (exists(fullName))
{ {
return fullName; return fullName;
} }
} }
// Nothing found // Not found
return fileName::null; return fileName::null;
} }

View File

@ -89,8 +89,6 @@ bool chDir(const fileName& dir);
//- Search for @em name in the following hierarchy: //- Search for @em name in the following hierarchy:
// -# personal settings: // -# personal settings:
// - ~/.OpenFOAM-\<VERSION\>
// <em>(old style)</em>
// - ~/.OpenFOAM/\<VERSION\>/ // - ~/.OpenFOAM/\<VERSION\>/
// <em>for version-specific files</em> // <em>for version-specific files</em>
// - ~/.OpenFOAM/ // - ~/.OpenFOAM/

View File

@ -37,7 +37,8 @@
# Sources the relevant cshrc/bashrc if not set. # Sources the relevant cshrc/bashrc if not set.
# #
# WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been 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 # Usage
# wmakeScheduler COMMAND # wmakeScheduler COMMAND
@ -45,7 +46,7 @@
# #
# wmakeScheduler -count # wmakeScheduler -count
# count the total number of slots available in WM_HOSTS # count the total number of slots available in WM_HOSTS
# eg, WM_NCOMPPROCS=$(wmakeScheduler -count) # eg, export WM_NCOMPPROCS=$(wmakeScheduler -count)
# #
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
lockDir=$HOME/.wmakeScheduler lockDir=$HOME/.wmakeScheduler
@ -81,21 +82,15 @@ case $SHELL in
;; ;;
esac esac
# check ~/.$WM_PROJECT-$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/ # check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/ # check ~/.$WM_PROJECT/
# check <installedProject>/etc/ # check <installedProject>/etc/
# check <installedProject/.$WM_PROJECT-$WM_PROJECT_VERSION/
if [ "$WM_PROJECT" ]; then if [ "$WM_PROJECT" ]; then
: ${FOAM_DOT_DIR:=.$WM_PROJECT-$WM_PROJECT_VERSION}
for i in \ for i in \
$HOME/$FOAM_DOT_DIR \
$HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \ $HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.$WM_PROJECT \ $HOME/.$WM_PROJECT \
$WM_PROJECT_DIR/etc \ $WM_PROJECT_DIR/etc \
$WM_PROJECT_DIR/$FOAM_DOT_DIR \
; ;
do do
if [ -f "$i/$shellRc" ]; then if [ -f "$i/$shellRc" ]; then
@ -107,9 +102,20 @@ fi
# Construct test string for remote execution. # Construct test string for remote execution.
# Source WM_PROJECT settings if WM_PROJECT environment not set. # Source WM_PROJECT settings if WM_PROJECT environment not set.
# attempt to preserve the installation directory 'FOAM_INST_DIR'
case $sourceFoam in case $sourceFoam in
*/cshrc) sourceFoam='if ( ! $?WM_PROJECT ) source '"$sourceFoam";; */bashrc)
*/bashrc) sourceFoam='[ "$WM_PROJECT" ] || . '"$sourceFoam";; 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 esac
# quote double-quotes for remote command line # quote double-quotes for remote command line
@ -160,7 +166,7 @@ do
if lockfile -r0 "$lockFile" 2>/dev/null; then if lockfile -r0 "$lockFile" 2>/dev/null; then
# Set colour # Set colour
colour=${colours[$colourIndex]} colour=${colours[$colourIndex]}
#echo "** host=$host colourIndex=$colourIndex colour=$colour" ## echo "** host=$host colourIndex=$colourIndex colour=$colour"
if [ "$host" = "$HOST" ]; then if [ "$host" = "$HOST" ]; then
if [ "$colour" ]; then if [ "$colour" ]; then

View File

@ -37,7 +37,8 @@
# Sources the relevant cshrc/bashrc if not set. # Sources the relevant cshrc/bashrc if not set.
# #
# WM_PROJECT_DIR, WM_PROJECT and WM_PROJECT_VERSION will have been 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 # Usage
# wmakeScheduler COMMAND # wmakeScheduler COMMAND
@ -45,7 +46,7 @@
# #
# wmakeScheduler -count # wmakeScheduler -count
# count the total number of slots available in WM_HOSTS # count the total number of slots available in WM_HOSTS
# eg, WM_NCOMPPROCS=$(wmakeScheduler -count) # eg, export WM_NCOMPPROCS=$(wmakeScheduler -count)
# #
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
lockDir=$HOME/.wmakeScheduler lockDir=$HOME/.wmakeScheduler
@ -81,21 +82,15 @@ case $SHELL in
;; ;;
esac esac
# check ~/.$WM_PROJECT-$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/ # check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/
# check ~/.$WM_PROJECT/ # check ~/.$WM_PROJECT/
# check <installedProject>/etc/ # check <installedProject>/etc/
# check <installedProject/.$WM_PROJECT-$WM_PROJECT_VERSION/
if [ "$WM_PROJECT" ]; then if [ "$WM_PROJECT" ]; then
: ${FOAM_DOT_DIR:=.$WM_PROJECT-$WM_PROJECT_VERSION}
for i in \ for i in \
$HOME/$FOAM_DOT_DIR \
$HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \ $HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \
$HOME/.$WM_PROJECT \ $HOME/.$WM_PROJECT \
$WM_PROJECT_DIR/etc \ $WM_PROJECT_DIR/etc \
$WM_PROJECT_DIR/$FOAM_DOT_DIR \
; ;
do do
if [ -f "$i/$shellRc" ]; then if [ -f "$i/$shellRc" ]; then
@ -203,7 +198,7 @@ do
fi fi
done done
done done
# Not found any free slots. Rest a bit. # Did not find any free slots. Rest a bit.
sleep 1 sleep 1
done done