Clarification on the codes of the errors thrown by listDirectory?

sonne kindaro at gmail.com
Sat Mar 10 19:26:04 UTC 2018


Hello!

In `directory` package, there is a function
`System.Directory.listDirectory`. It says on the box that it throws
error messages that can be branched on. (`isDoesNotExistError`,
`InappropriateType` and so on.) I dug into it a little, and it appears
to me that, in actuality, on Windows (unlike on a Posix compliant
operating system) there is no reliable way to sort the errors in some
pre-defined categories like "no such file", "not a directory", et
cetera.

Therefore I must presume that either the documentation is incomplete
and misleading, or it is I who is somehow misled. The information I
have is summarized in a Stack Overflow question linked below. I would
like to receive a clarification. Perhaps an amendment to the
documentation should be considered?

The point that initially aroused my suspicion is that `NoSuchThing` is
associated with both `eNoEnt` and `eNotDir`. Is there a rationale
behind this? From the `man 3 opendir`, I do not see the need for this
ambiguity.

This is the S.O. question I mentioned: stackoverflow.com/q/49212400
There is also a linked question that elaborates on the motivation
behind my inquiry.

Thank you!


More information about the Libraries mailing list