System.Directory (was RE: Proposal for a new I/O library design)
Glynn Clements
glynn.clements@virgin.net
Tue, 29 Jul 2003 01:55:21 +0100
Hal Daume wrote:
> 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...
Either '\\' or '/' on Windows. The former is preferred, but the latter
also works in most contexts.
For Windows, there's also the issue of drive letters and network (UNC)
paths.
> > isCaseSensitive :: Bool
> > False on Windows, True on (all?) unices, i have no idea on macs
It's more accurate to say that most "native" Unix filesystems are
case-sensitive. However, many Unix systems can mount "foreign"
filesystems (FAT, SMB) which aren't case-sensitive.
Another significant distinction is in the handling of non-ASCII
characters. Windows treats filenames as lists of characters; VFAT and
NTFS use Unicode, while FAT filesystems may have an associated
codepage. OTOH, Unix treats filenames as lists of bytes; while
applications may impose an (arbitrary) encoding on filenames, the OS
doesn't.
--
Glynn Clements <glynn.clements@virgin.net>