root-directories procedure Lassi Kortela 23 Feb 2020 10:38 UTC

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.