Closed wyldckat closed 3 months ago
So the simplest trick seems to be to define a bash function for pwd
before sourcing OpenFOAM's bashrc
, e.g.:
function pwd()
{
bash -c pwd
}
Because this will give us the Linux-mode path, instead of the Windows-mode:
$ pwd
/home/ofuser/blueCFD/OpenFOAM-12
$ pwd -P
/c/Program Files/blueCFD-Core-2024/OpenFOAM-12
It is being used in the following situations:
$ grep -r pwd
bashrc: export FOAM_INST_DIR=$(cd $(dirname $bashrcFile)/../.. && pwd -P)
bashrc: WM_PROJECT_DIR_REAL=$(cd $WM_PROJECT_DIR && pwd -P)
bashrc: WM_THIRD_PARTY_DIR_REAL=$(cd $WM_THIRD_PARTY_DIR && pwd -P)
config.csh/paraview: set paraviewBinDir=`cd $pvserverBinDir && pwd -P`
config.sh/paraview: paraviewBinDir=$(cd $paraviewBinDir && pwd -P)
pre-bashrc-custom-gcc47.sh: export REF_OF_ETC=$(cd $(dirname $bashrcFile) && pwd -P)
pre-bashrc-custom-gcc48.sh: export REF_OF_ETC=$(cd $(dirname $bashrcFile) && pwd -P)
pre-bashrc-mingw_w32.sh: export REF_OF_ETC=$(cd $(dirname $bashrcFile) && pwd -P)
pre-bashrc-mingw_w64.sh: export REF_OF_ETC=$(cd $(dirname $bashrcFile) && pwd -P)
Note: Cannot use cygpath -s -m
for converting the path to Windows short path, because it gets stuck somehow.
The bash function has to rely on short paths, because the OpenFOAM scripts are not all ready for paths with spaces. Which means that we will either need:
74682c5adee9da71488630fe6437e0156c45e74d
at https://github.com/blueCFD/OpenFOAM-dev/commits/blueCFD-Core-12/All issues reported here have been fixed and will be delivered in blueCFD-Core 2024-2.
Note: We have added the following note next to the download links for blueCFD-Core 2024-1:
When we install at the default
C:\Program Files\blueCFD-Core 2024-1
, it is not able to source theetc/bashrc
file for OpenFOAM, because MSYS2 has changed howpwd -P
works since 2021. It used to give relative to the original mount path, but now it fully unravels the path to Windows' long path mode.So either:
etc/bashrc
.C:\blueCFD-Core\2024-1
, which can be fairly annoying, but given how we use the files within it, it might not be a bad idea overall.