The Rust standard library has a Path::is_dir method that returns false
for any I/O error (such as a permission error),
not just "No such file or directory".
Instead add an is_dir function that returns false for non-directories
and for "No such file or directory" errors, but propagates other I/O errors.