The dir? function is intended to be an easy-to-use way to check if a file or file path is a directory.
For example, when processing a list of files we often write:
foreach file file-list [
unless dir? file [
The problem is that dir? does two things:
- It checks if the filename ends with a slash (/).
- It checks if the file is a directory on local storage.
This behavior is problematic because the filenames being checked may have nothing to do with local storage. In the example above, the list of files may have been fetched from a server or a database, and they're not related to what's on disk.
So, we need to define dir? a little better. It should do one of the above operations, but not both.
Personally, I'd prefer the first behavior, because that's what I use the most. I never do the second, because I'm using filenames that were obtained from a directory, so they contain the slash in their names. However, that's not compatible with R2.
The second behavior could be supported with a refinement, like dir?/query which would perform the actual disk query.