mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-10 03:51:18 +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_CONTROL 0x0008
|
||||||
#define MK_MBUTTON 0x0010
|
#define MK_MBUTTON 0x0010
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CString Str
|
#define CString Str
|
||||||
|
@ -213,6 +216,7 @@ private:
|
||||||
HANDLE findHandle;
|
HANDLE findHandle;
|
||||||
WIN32_FIND_DATA findFileData;
|
WIN32_FIND_DATA findFileData;
|
||||||
#else
|
#else
|
||||||
|
DIR *findHandle;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,28 @@ EPathCheck CheckFile( const char *path ) {
|
||||||
return PATH_FILE;
|
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
|
#else
|
||||||
|
|
||||||
FindFiles::FindFiles( const char *_directory ) {
|
FindFiles::FindFiles( const char *_directory ) {
|
||||||
|
|
Loading…
Reference in a new issue