[Box Backup-dev] COMMIT r775 - box/chris/general/lib/win32

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Fri Aug 11 09:34:20 BST 2006


Author: chris
Date: 2006-08-11 09:34:19 +0100 (Fri, 11 Aug 2006)
New Revision: 775

Modified:
   box/chris/general/lib/win32/emu.cpp
   box/chris/general/lib/win32/emu.h
Log:
* lib/win32/emu.cpp
* lib/win32/emu.h
- Added d_type member to struct dirent, initialise with S_IFDIR or S_IFREG
- MinGW compile fix


Modified: box/chris/general/lib/win32/emu.cpp
===================================================================
--- box/chris/general/lib/win32/emu.cpp	2006-08-11 08:33:15 UTC (rev 774)
+++ box/chris/general/lib/win32/emu.cpp	2006-08-11 08:34:19 UTC (rev 775)
@@ -1000,7 +1000,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, 
@@ -1008,6 +1008,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/general/lib/win32/emu.h
===================================================================
--- box/chris/general/lib/win32/emu.h	2006-08-11 08:33:15 UTC (rev 774)
+++ box/chris/general/lib/win32/emu.h	2006-08-11 08:34:19 UTC (rev 775)
@@ -6,7 +6,9 @@
 // basic types, may be required by other headers since we
 // don't include sys/types.h
 
-#ifndef __MINGW32__
+#ifdef __MINGW32__
+	#include <stdint.h>
+#else // MSVC
 	typedef unsigned __int64 u_int64_t;
 	typedef unsigned __int64 uint64_t;
 	typedef          __int64 int64_t;
@@ -232,6 +234,7 @@
 struct dirent
 {
 	char *d_name;
+	unsigned long d_type;
 };
 
 struct DIR




More information about the Boxbackup-dev mailing list