int file_isdir(const char *zFilename){
struct stat buf;
+#ifdef __MINGW32__
+ /* mingw has a bug where a trailing slash causes ISDIR to be zero */
+ Blob SaneName;
+
+ file_canonical_name(zFilename, &SaneName);
+ if( stat(blob_str(&SaneName), &buf)!=0 ){
+ blob_reset(&SaneName);
+ return 0;
+ }
+ blob_reset(&SaneName);
+#else
if( stat(zFilename, &buf)!=0 ){
return 0;
}
+#endif
return S_ISDIR(buf.st_mode) ? 1 : 2;
}