
Beman Dawes wrote:
... with the following errors I can't see any way to know if the path actually exists or not:
[EACCES] Search permission is denied for a component of the path prefix.
[EIO] An error occurred while reading from the file system.
[ELOOP] A loop exists in symbolic links encountered during resolution of the path argument.
[ENAMETOOLONG] The length of the path argument exceeds {PATH_MAX} or a pathname component is longer than {NAME_MAX}.
If you agree with that analysis, then it looks like exists() should be changed to throw on those last four errors.
Looks to me that 'exists()' must yield a tri-state result if its going to be kept with existing name. Some questions cannot be answered with only yes or no. An alternative to tri-state is to split the thing into two or more functions. I vaguely remember seeing some documentation about this where the current interface seemed obscure to me, the client code programmer having to keep in mind a table of possible combinations of results and what they would mean. Sorry I'm too lazy to look into this again, but if that vague recollection is correct, then I suggest that the elements in that table indicate the functions that _should_ be there.