etc/bashrc: Added better handling for symbolic links in the WM_PROJECT_DIR path
Patch contributed by Bruno Santos
This commit is contained in:
22
etc/bashrc
22
etc/bashrc
@ -2,7 +2,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration | Website: https://openfoam.org
|
||||
# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
# \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -113,10 +113,30 @@ foamOldDirs="$WM_PROJECT_DIR $WM_THIRD_PARTY_DIR \
|
||||
export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
|
||||
export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
|
||||
|
||||
if [ -d "$WM_PROJECT_DIR" ]
|
||||
then
|
||||
WM_PROJECT_DIR_REAL=$(cd $WM_PROJECT_DIR && pwd -P)
|
||||
if [ -d "$WM_PROJECT_DIR_REAL" -a -e "$WM_PROJECT_DIR_REAL/etc/bashrc" ]
|
||||
then
|
||||
export WM_PROJECT_DIR=$WM_PROJECT_DIR_REAL
|
||||
fi
|
||||
unset WM_PROJECT_DIR_REAL
|
||||
fi
|
||||
|
||||
# Location of third-party software
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
|
||||
|
||||
if [ -d "$WM_THIRD_PARTY_DIR" ]
|
||||
then
|
||||
WM_THIRD_PARTY_DIR_REAL=$(cd $WM_THIRD_PARTY_DIR && pwd -P)
|
||||
if [ -d "$WM_THIRD_PARTY_DIR_REAL" -a -e "$WM_THIRD_PARTY_DIR_REAL/etc/tools" ]
|
||||
then
|
||||
export WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR_REAL
|
||||
fi
|
||||
unset WM_THIRD_PARTY_DIR_REAL
|
||||
fi
|
||||
|
||||
# Location of site-specific templates etc
|
||||
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
# unset is equivalent to $WM_PROJECT_INST_DIR/site
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration | Website: https://openfoam.org
|
||||
# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
# \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -260,10 +260,11 @@ unset targetType
|
||||
if [ -d "$MakeDir" ]
|
||||
then
|
||||
objectsDir=$MakeDir/$WM_OPTIONS
|
||||
if [[ "$PWD" = *"$WM_PROJECT_DIR"* ]]
|
||||
expandPath "$PWD"
|
||||
if [[ "$exPath" = *"$WM_PROJECT_DIR"* ]]
|
||||
then
|
||||
platformPath=$WM_PROJECT_DIR/platforms/${WM_OPTIONS}
|
||||
objectsDir=$platformPath${PWD//$WM_PROJECT_DIR/}
|
||||
objectsDir=$platformPath${exPath//$WM_PROJECT_DIR/}
|
||||
fi
|
||||
rm -rf "$objectsDir" 2>/dev/null
|
||||
fi
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration | Website: https://openfoam.org
|
||||
# \\ / A nd | Copyright (C) 2015-2018 OpenFOAM Foundation
|
||||
# \\ / A nd | Copyright (C) 2015-2019 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -227,12 +227,16 @@ oldFolders)
|
||||
|
||||
updateMode)
|
||||
|
||||
if [ "$PWD" != "$WM_PROJECT_DIR" ]
|
||||
expandPath "$PWD"
|
||||
if [ "$exPath" != "$WM_PROJECT_DIR" ]
|
||||
then
|
||||
echo "Cannot 'update', not in the project top-level directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Go into the real path
|
||||
cd "$exPath"
|
||||
|
||||
echo "Removing dep files corresponding to source files that no longer exist..."
|
||||
fileNameList=$(find -L src applications -name '*.[CHL]' -type l)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user