CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Bugs

Cleaning up PATH and LD_LIBRARY_PATH when switching between different versions of OpenFOAM

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   March 12, 2008, 05:19
Default Hello, This is not a bug pe
  #1
Senior Member
 
Martin Beaudoin
Join Date: Mar 2009
Posts: 330
Rep Power: 13
mbeaudoin will become famous soon enough
Hello,

This is not a bug per se, just a little suggestion for improvement.

When switching between different versions of OpenFOAM from the same active shell, let's say switching to OpenFOAM 1.4.1 from a shell previously initialized for OpenFOAM 1.3, the directories pointed by the "old" values of FOAM_USER_APPBIN and FOAM_USER_LIBBIN will not get cleaned up from the environment variables PATH and LD_LIBRARY_PATH when sourcing the "new" environment (sourcing the new $WM_PROJECT_DIR/$FOAM_DOT_DIR/bashrc or cshrc).

Here is the small modification we did to our copy of the file $WM_PROJECT_DIR/$FOAM_DOT_DIR/bashrc in order to correct this. The new instructions are in blue.

<hr width=75% size=2>

#- Clean path/PATH. Remove anything under top-level foam directory.
cleanPath=`$cleanProg "$PATH" "$WM_PROJECT_INST_DIR"`
if [ $? -eq 0 ]; then
PATH="$cleanPath"
fi

#- Clean LD_LIBRARY_PATH
export LD_LIBRARY_PATH=`$cleanProg "$LD_LIBRARY_PATH" "$WM_PROJECT_INST_DIR"`

#- Clean MANPATH
export MANPATH=`$cleanProg "$MANPATH" "$WM_PROJECT_INST_DIR"`


#- Clean everything that looks a bit too much like an old $FOAM_USER_APPBIN from PATH
cleanPath=`$cleanProg "$PATH" "$HOME/$WM_PROJECT/$LOGNAME"`
if [ $? -eq 0 ]; then
PATH="$cleanPath"
fi

#- Clean everything that looks a bit too much like an old $FOAM_USER_LIBBIN from LD_LIBRARY_PATH
export LD_LIBRARY_PATH=`$cleanProg "$LD_LIBRARY_PATH" "$HOME/$WM_PROJECT/$LOGNAME"`


# FOAM: set-up FOAM release-specific environment
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SOURCE(){
foamDotFile=$1
. $1
foamDotFile=
}
SOURCE $WM_PROJECT_DIR/.bashrc


<hr width=75% size=2>
A similar modification could be applied to the file $WM_PROJECT_DIR/$FOAM_DOT_DIR/cshrc as well.

Martin
mbeaudoin is offline   Reply With Quote

Old   March 12, 2008, 05:29
Default Good suggestion, I will put it
  #2
Senior Member
 
Join Date: Mar 2009
Posts: 854
Rep Power: 13
henry is on a distinguished road
Good suggestion, I will put it in and also the equivalent in cshrc.

Thanks

Henry
henry is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Proposal for a modification of the initscripts to make switching versions easier gschaider OpenFOAM Bugs 2 December 21, 2007 15:10
Switching to OpenFOAM Merits and capabilities s195404 OpenFOAM 0 December 11, 2007 23:17
presure distribution in gas cleaning bala FLUENT 0 September 8, 2006 01:57
Cleaning up operations Vidya Raja FLUENT 3 May 22, 2006 14:17
Different PATH and OpenFOAM 11 ds2taieb OpenFOAM Installation 0 January 25, 2006 14:15


All times are GMT -4. The time now is 13:41.