-#ifndef _MSC_VER
- struct stat buf;
- stat(dirName.c_str(), &buf);
- return S_ISDIR(buf.st_mode);
+ struct stat fs;
+ assert( dirName[dirName.size()-1] != '/' );
+ if ( stat(dirName.c_str(), &fs) == 0 )
+ {
+#if _WIN32
+ return ((fs.st_mode & _S_IFDIR) != 0);