[Box Backup-commit] COMMIT r962 - box/chris/merge/lib/win32
subversion at fluffy.co.uk
subversion at fluffy.co.uk
Mon Sep 4 01:05:09 BST 2006
Author: chris
Date: 2006-09-04 01:05:08 +0100 (Mon, 04 Sep 2006)
New Revision: 962
Modified:
box/chris/merge/lib/win32/emu.cpp
box/chris/merge/lib/win32/emu.h
Log:
(refs #3)
Emulate readdir's d_type field
Modified: box/chris/merge/lib/win32/emu.cpp
===================================================================
--- box/chris/merge/lib/win32/emu.cpp 2006-09-04 00:03:28 UTC (rev 961)
+++ box/chris/merge/lib/win32/emu.cpp 2006-09-04 00:05:08 UTC (rev 962)
@@ -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/chris/merge/lib/win32/emu.h
===================================================================
--- box/chris/merge/lib/win32/emu.h 2006-09-04 00:03:28 UTC (rev 961)
+++ box/chris/merge/lib/win32/emu.h 2006-09-04 00:05:08 UTC (rev 962)
@@ -329,9 +329,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
More information about the Boxbackup-commit
mailing list