Commit 26eaa838 introduces the use of S_ISDIR() yet some compilers, such as MSVC don't support it, so we must define a substitute using file flags and mask.