You can't tell by looking at a path either on Posix or on Windows whether it is remote:  on my Windows box, the N: drive is in fact an Amazon S3 bucket, and it would be expensive in both time and $$$ to fully enumerate it.  I definitely do not want programs thinking it is safe to enumerate my whole system.

And yes, determining if an UNC path is meaningful is a matter of trying and then waiting for a timeout, just like connecting to an IP address.



On Sun, Feb 23, 2020 at 5:38 AM Lassi Kortela <xxxxxx@lassi.io> wrote:
I've been thinking Scheme should have this kind of procedure:

Unix:

(root-directories) => ("/")

Windows (varies based on what drives are mounted):

(root-directories) => ("C:" "D:" "G:" "Z:")

Windows can also do UNC pathnames (\\somecomputer\\whatevs) but those
are not as simple and fast to enumerate as drives are.

It's also useful to have a (root-directory? path) procedure. That's
different from enumerating the root directories, since the enumeration
can change at any time as drives are mounted and unmounted. Whereas
`root-directory?` is more about the syntax (on Windows, is the path
syntactically a UNC path or starts with a drive letter?)

I guess you could have a separate `mounted-root-directory?` predicate
but I don't know whether it's useful.