In std.file the functions isDir, isFile and dirEntry all throw if a path does not exist.
Therefor one needs a separate stat call to test for existence.
Also dirEntry does enforce again that a path exists.
Comment #1 by razvan.nitu1305 — 2017-10-05T08:28:47Z
There are 2 ways to solve this:
1. Either check that the file or directory exists inside the isDir/isFile functions and return false if the path does not exist or the input string doesn't designate a directory/file. This is troublesome since you have one value for 2 different semantics.
2. Create a function existsAndIsDir/File where you can call stat a single time. This means adding 2 new functions that add no extra functionality for the benefit of a micro-optimization.
In my opinion we should close this as WONTFIX.
Comment #2 by petar.p.kirov — 2017-10-05T09:47:27Z