mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-09 19:41:04 +00:00
* implemented FindFiles, NextFile and ~FindFiles for linux
git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/branches/ZeroRadiant@228 8a3a26a2-13c4-0310-b231-cf6edde360e5
This commit is contained in:
parent
94199c49dc
commit
3a05e084dd
2 changed files with 42 additions and 16 deletions
|
@ -73,6 +73,9 @@ int MemorySize(void *ptr);
|
|||
#define MK_CONTROL 0x0008
|
||||
#define MK_MBUTTON 0x0010
|
||||
|
||||
#include <dirent.h>
|
||||
#include <iostream>
|
||||
|
||||
#endif
|
||||
|
||||
#define CString Str
|
||||
|
@ -213,6 +216,7 @@ private:
|
|||
HANDLE findHandle;
|
||||
WIN32_FIND_DATA findFileData;
|
||||
#else
|
||||
DIR *findHandle;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -142,6 +142,28 @@ EPathCheck CheckFile( const char *path ) {
|
|||
return PATH_FILE;
|
||||
}
|
||||
|
||||
FindFiles::FindFiles( const char *_directory ) {
|
||||
findHandle = opendir( _directory );
|
||||
}
|
||||
|
||||
FindFiles::~FindFiles() {
|
||||
if ( findHandle != NULL ) {
|
||||
closedir( findHandle );
|
||||
}
|
||||
}
|
||||
|
||||
const char* FindFiles::NextFile() {
|
||||
struct dirent *d;
|
||||
|
||||
if ( findHandle == NULL )
|
||||
return NULL;
|
||||
|
||||
d = readdir( findHandle );
|
||||
if ( d )
|
||||
return d->d_name;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
FindFiles::FindFiles( const char *_directory ) {
|
||||
|
|
Loading…
Reference in a new issue