blob: edfc9d876c2b5e0969b96b2a78564c2bfd99d3d0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#ifndef _READDIR_H
#define _READDIR_H
#include <bfc/common.h>
#include <bfc/string/StringW.h>
/* intended use:
ReadDir dir(path);
while (dir.next()) {
const char *fn = dir.getFilename();
}
*/
class ReadDir
{
public:
ReadDir(const wchar_t *path, const wchar_t *match=NULL, bool skipdots=true);
~ReadDir();
int next(); // done when returns 0
const wchar_t *getFilename();
int isDir(); // if current file is a dir
int isReadonly(); // if current file is readonly
int isDotDir(); // if given dir iteself is being enumerated (usually ".")
int isDotDotDir(); // if parent dir of cur dir is showing (usually "..")
const wchar_t *getPath() { return path; }
private:
StringW path, match;
int skipdots, first;
//PORT
#ifdef WIN32
HANDLE files;
WIN32_FIND_DATAW data; // (shrug) so we have two? so what?
//StringW filename;
#endif
#ifdef LINUX
DIR *d;
struct dirent *de;
struct stat st;
#endif
};
#endif
|