[Haskell-cafe] Abstracted File Library?

Marc Weber marco-oweber at gmx.de
Mon Apr 26 23:46:40 EDT 2010

Hi Kazu,

I don't have a ghc Windows installation at the moment so I can't test.

filepath has functions such as normalise and equalFilePath.

Have a look at splitPath which is using pathSeparators which allows both
\\ and / on Windows.

filpath is using \\ to join pathes though.
So appling normalise on filepath on Windowsn will result in 
having paths containing \\ only.
This will still not help you writing your regex unless you replace / by
\\ on Windows.

It's easy to write [\\/] in regex to catch both.

So maybe a normalisePosix function should be added which always returns
/ ?

The fast way which would work for you only is making pathSeparator
return "/" only. Then you're done but your code will not be portable..

Including a local copy of filepath for exactly this reason could be an
option for you.

> isSymbolicLink, linkCounts, etc.

Don't know about them..

Marc Weber

More information about the Haskell-Cafe mailing list