]> Chaos Git - console/RCOMage.git/commitdiff
Fix up Win32 version of is_dir()
authorzingaburga <zingaburga@hotmail.com>
Sat, 5 Feb 2011 22:55:09 +0000 (08:55 +1000)
committerzingaburga <zingaburga@hotmail.com>
Sat, 5 Feb 2011 22:55:09 +0000 (08:55 +1000)
Still untested

src/configscan.c

index d1c35d5b26c179f8ef33eb4bca3b8177a23c7133..9abb70a9de8e35beb3e5b9e5611a9f176cb4c70b 100644 (file)
@@ -25,8 +25,11 @@ int get_ini_line (FILE * fp, char *buf, char **out1, char **out2);
 static int is_dir(char *path)
 {
   WIN32_FIND_DATA fd;
-  CloseHandle(FindFirstFile(path, &fd));
-  return (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
+  HANDLE h = FindFirstFile(path, &fd);
+  if(h == INVALID_HANDLE_VALUE)
+    return 0;
+  CloseHandle(h);
+  return (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY && strlen(fd.cFileName) > 0);
 }
 #else
 #include <sys/types.h>