From: zingaburga Date: Sat, 5 Feb 2011 22:55:09 +0000 (+1000) Subject: Fix up Win32 version of is_dir() X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=54ca649a9a6aba150a1fbe423f4c3aec611ee913;p=console%2FRCOMage.git Fix up Win32 version of is_dir() Still untested --- diff --git a/src/configscan.c b/src/configscan.c index d1c35d5..9abb70a 100644 --- a/src/configscan.c +++ b/src/configscan.c @@ -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