All these questions are actually Windows-centric; the answers are different on Unix.

On Oct 12, 2007, at 13:21 , Andrew Coppin wrote:

I notice that getDirectoryContents appears to return its results in alphabetical order. Is this behaviour actually guaranteed?

There is no guarantee, however on Windows this is done by invoking Win32 directory globbing routines which happen to return things in alpha order. (On Unix it might be alpha order if the underlying filesystem is a btree, but there are no guarantees at all except perhaps that '.' and '..' come first.)

Related: Is there a way to get rid of "." and ".." in the results? (Obviously this causes directory recusion to malfunction.) I can of course manually filter them out, but it's annoying.

Manual filtering is always required, whether C, Perl, Haskell, etc. I dunno, maybe python filters them for you or something. Every language I've ever used makes you deal.

 doesDirectoryExist "C:"
 doesDirectoryExist "C:\"

both yield False? (This frequently trips up programs that try to check that a destination folder exists.)

Ask Microsoft. Drive top level handling has been weird since MS-DOS 2.0.

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university    KF8NH


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to