[racket] Behavior of file-exists? and directory-list

From: Tim Nelson (tbnelson at gmail.com)
Date: Thu Dec 6 17:13:13 EST 2012

Dear Benevolent Racketeers,

I just installed DrRacket 5.3.1 on my Windows 8 Laptop. (Yes,
Windows 8, please don't laugh at me. :-) ) I have not checked
this on other operating systems or other versions of Racket.

One of my Racket projects scans the PATH directories to locate
the Java executable, if one is installed. I have the
executable "java.exe" present in the C:\Windows\System32 folder,
yet:

> (file-exists? "C:\\Windows\\System32")
#f

To check myself, I invoked and manually scanned
down (directory-list "C:\\Windows\\System32"), expecting to see
#<path:java.exe> but did not.

Moreover, counting hidden files and subfolders, I had 3576 files
in that folder (confirmed via command prompt, not recursive). If
I don't include hidden files, I have 3238. But:

> (length (directory-list "C:\\Windows\\System32"))
2739

So it appears that (directory-list) is missing several hundred
files that actually exist, including java.exe. java.exe is not
hidden, not read-only, and it's not obviously a link. (And
even if it was, shouldn't file-exists? and directory-list
include it?)

On my Windows 7 PC at home, directory-list finds java.exe, but still
lists a hundred plus fewer files than appear via DIR:

> (length (directory-list "C:\\Windows\\System32"))
2389

C:\Windows\System32>DIR
2720 File(s) ...
91 Dir(s) ...

I'm stumped. I even tried to track directory-list to its source,
but lost the scent in pre-base.rkt.

What am I missing here? Is this a potential problem with these
functions in Windows 7 and 8, or am I perhaps using them incorrectly?

Thanks,
- Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121206/4b69049f/attachment.html>

Posted on the users mailing list.