I am looking for something similar to Python os.path.expandvars
in Haskell, i.e. a function FilePath -> IO FilePath
that
- Cross-platform (supports Windows
%VAR%
and Unix styles $VAR
) - Standard (I do not want to write my own function for this).
Example:
> expandVars "$HOME/foo/bar"
"/home/someuser/foo/bar"
I searched on Hoogle, Hayoo, and Google, but didn't find anything, which is surprising given the number of cross-platform Haskell tools. The closest I found this implementation is for Unix only . Perhaps there is some kind of project that implements this as a subroutine?
source
share