expanduser() home directory tilde Fortran

less than 1 minute read

Fortran does not understand tilde ~ in commands like open(). Just like in Python and some Matlab functions, an expanduser() procedure is needed. We provide this functionality in expanduser.f90, which is tested on Mac/Linux/Windows.

Note

You may not have realized this is an issue because the shell typically expands ~ itself. It becomes an issue when reading an absolute path involving ~ from say a config file using Fortran and then trying to open that filename read from the config file.

Leave a comment