[Scummvm-cvs-logs] SF.net SVN: scummvm: [27892] scummex/branches/gsoc2007-gameresbrowser/src/ plugins/Directories.cpp
zbychs at users.sourceforge.net
zbychs at users.sourceforge.net
Wed Jul 4 04:05:48 CEST 2007
Revision: 27892
http://scummvm.svn.sourceforge.net/scummvm/?rev=27892&view=rev
Author: zbychs
Date: 2007-07-03 19:05:48 -0700 (Tue, 03 Jul 2007)
Log Message:
-----------
Making Directories.cpp compile under Linux.
Modified Paths:
--------------
scummex/branches/gsoc2007-gameresbrowser/src/plugins/Directories.cpp
Modified: scummex/branches/gsoc2007-gameresbrowser/src/plugins/Directories.cpp
===================================================================
--- scummex/branches/gsoc2007-gameresbrowser/src/plugins/Directories.cpp 2007-07-04 01:34:12 UTC (rev 27891)
+++ scummex/branches/gsoc2007-gameresbrowser/src/plugins/Directories.cpp 2007-07-04 02:05:48 UTC (rev 27892)
@@ -10,8 +10,13 @@
#include <iostream>
#include <stdlib.h>
-#include <io.h>
+#ifdef _MSC_VER
+ #include <io.h>
+#else
+ #include <dirent.h>
+#endif
+
#include "debugmem.h"
namespace Browser {
@@ -139,6 +144,8 @@
if (_created)
return;
+#ifdef _MSC_VER
+
std::string match = _directoryPath + NATIVE_SLASH + "*";
struct _finddata_t c_file;
intptr_t hFile = _findfirst( match.c_str(), &c_file );
@@ -158,6 +165,28 @@
} while( _findnext( hFile, &c_file ) == 0 );
_findclose( hFile );
+#else
+ #ifndef _DIRENT_HAVE_D_TYPE
+ #error Must have dirent.d_type field.
+ #endif
+
+ DIR *DirectoryPointer;
+ DirectoryPointer = opendir( _directoryPath.c_str() );
+ while(true) {
+ dirent* dp = readdir(DirectoryPointer)
+ if (dp == NULL)
+ break;
+ std::string fullpath = _directoryPath + NATIVE_SLASH + dp->d_name;
+ if (dp->d_type == DT_DIR)
+ addSubDir(dp->d_name, fullpath);
+ else
+ if (dp->d_type == DT_REG)
+ addFile(dp->d_name, fullpath);
+ }
+ closedir(DirectoryPointer);
+
+#endif
+
IDirectoryImpl::create();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list