diff options
-rw-r--r-- | lib/win32/emu.cpp | 10 | ||||
-rw-r--r-- | lib/win32/emu.h | 5 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/win32/emu.cpp b/lib/win32/emu.cpp index 423b3632..109e54f6 100644 --- a/lib/win32/emu.cpp +++ b/lib/win32/emu.cpp @@ -1002,7 +1002,7 @@ struct dirent *readdir(DIR *dp) if (!dp->result.d_name || _wfindnext(dp->fd, &dp->info) != -1) { - den = &dp->result; + den = &dp->result; std::wstring input(dp->info.name); memset(tempbuff, 0, sizeof(tempbuff)); WideCharToMultiByte(CP_UTF8, 0, dp->info.name, @@ -1010,6 +1010,14 @@ struct dirent *readdir(DIR *dp) NULL, NULL); //den->d_name = (char *)dp->info.name; den->d_name = &tempbuff[0]; + if (dp->info.attrib & FILE_ATTRIBUTE_DIRECTORY) + { + den->d_type = S_IFDIR; + } + else + { + den->d_type = S_IFREG; + } } } else diff --git a/lib/win32/emu.h b/lib/win32/emu.h index 2c4e1550..69daaa67 100644 --- a/lib/win32/emu.h +++ b/lib/win32/emu.h @@ -329,9 +329,14 @@ inline int strcasecmp(const char *s1, const char *s2) } #endif +#ifdef _DIRENT_H_ +#error You must not include MinGW's dirent.h! +#endif + struct dirent { char *d_name; + unsigned long d_type; }; struct DIR |