Skip to content

Commit

Permalink
etc/bashrc: Added better handling for symbolic links in the WM_PROJEC…
Browse files Browse the repository at this point in the history
…T_DIR path

Patch contributed by Bruno Santos
  • Loading branch information
Henry Weller committed Jul 22, 2019
1 parent b5f4715 commit 94642ba
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
22 changes: 21 additions & 1 deletion etc/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions wmake/wclean
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions wmake/wrmdep
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 94642ba

Please sign in to comment.