System.Directory (was RE: Proposal for a new I/O library design)

Hal Daume
Mon, 28 Jul 2003 07:58:45 -0700

Hi guys,

I'm not replying to anything in the message, but...

> Is the idea
> to abstract away from the syntax of pathnames on the platform (eg.
> directory separator characters)?  If so, I'm not sure it's worthwhile.
> There are lots of differences between pathname conventions: case
> sensitivity, arbitrary limits on the lengh of filenames, filename
> extensions, and so on.

Would there be any way to get some of these differences into the
System.Directory structure?  At least the following would be nice:

> pathSeparator :: Char
> '\\' on Windows, '/' on unices, ':' (I believe) on macs, etc...

> directorySeparator :: Char
> ';' on Windows, ':' on unices, i have no idea on macs

> isCaseSensitive :: Bool
> False on Windows, True on (all?) unices, i have no idea on macs

given just these, i think we'd all be a lot happier.  I also don't
particularly care whether these are IO operations or just values (so
long as they are constant, they might as well be values with
unsafePerformIO wrapped around them if necessary).

My current approach to figuring this out is to create a directory,
change to that directory, get the current path name and try to parse it.
This is bad for so many reasons I won't enumerate them here.

...unless this stuff is hiding somewhere else, please let me know (but
System.Directory would probably be a good place for it to end up)...

 - Hal