[Box Backup-commit] COMMIT r1135 - box/trunk/lib/win32
boxbackup-dev@fluffy.co.uk
boxbackup-dev@fluffy.co.uk
Fri, 27 Oct 2006 20:27:30 +0100
Author: chris
Date: 2006-10-27 20:27:30 +0100 (Fri, 27 Oct 2006)
New Revision: 1135
Modified:
box/trunk/lib/win32/emu.cpp
box/trunk/lib/win32/emu.h
Log:
Emulate readdir's d_type field.
Modified: box/trunk/lib/win32/emu.cpp
===================================================================
--- box/trunk/lib/win32/emu.cpp 2006-10-27 19:27:00 UTC (rev 1134)
+++ box/trunk/lib/win32/emu.cpp 2006-10-27 19:27:30 UTC (rev 1135)
@@ -1002,7 +1002,7 @@
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 @@
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
Modified: box/trunk/lib/win32/emu.h
===================================================================
--- box/trunk/lib/win32/emu.h 2006-10-27 19:27:00 UTC (rev 1134)
+++ box/trunk/lib/win32/emu.h 2006-10-27 19:27:30 UTC (rev 1135)
@@ -266,9 +266,14 @@
}
#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