29 |
|
|
30 |
#if WIN32 |
#if WIN32 |
31 |
|
|
32 |
|
/* |
33 |
|
dirent.h |
34 |
|
POSIX WIN32 Directory Browsing parts |
35 |
|
Copyright (C) 2005 OpenAsthra |
36 |
|
blogs.openasthra AT gmail.com |
37 |
|
modifications copyright 2009 by Benno Senoner |
38 |
|
Licence: LGPL |
39 |
|
*/ |
40 |
|
|
41 |
|
#ifndef _DIRENT_H_ |
42 |
|
#define _DIRENT_H_ |
43 |
|
|
44 |
|
#ifdef __cplusplus |
45 |
|
extern "C" |
46 |
|
{ |
47 |
|
#endif |
48 |
|
|
49 |
|
typedef struct DIR DIR; |
50 |
|
|
51 |
|
struct dirent{ |
52 |
|
long d_ino; |
53 |
|
long d_off; |
54 |
|
unsigned short d_reclen; |
55 |
|
unsigned char d_type; |
56 |
|
unsigned short d_namlen; |
57 |
|
char d_name[1]; |
58 |
|
}; |
59 |
|
|
60 |
|
DIR *opendir(const char *); |
61 |
|
int closedir(DIR *); |
62 |
|
struct dirent *readdir(DIR *); |
63 |
|
void rewinddir(DIR *); |
64 |
|
|
65 |
|
void seekdir (DIR *dirp, long int pos); |
66 |
|
long int telldir (DIR *dirp); |
67 |
|
|
68 |
|
int scandir(const char *dir, struct dirent ***namelist, |
69 |
|
int (*filter)(const struct dirent *), |
70 |
|
int (*compar)(const struct dirent **, const struct dirent **)); |
71 |
|
|
72 |
|
int ftw(const char *dirpath, |
73 |
|
int (*fn) (const char *fpath, const struct stat *sb, |
74 |
|
int typeflag), |
75 |
|
int nopenfd); |
76 |
|
|
77 |
|
|
78 |
|
int dirfd(DIR *dirp); |
79 |
|
|
80 |
|
#define S_IFMT 0170000 |
81 |
|
#define S_IFDIR 0040000 |
82 |
|
#define S_IFREG 0100000 |
83 |
|
|
84 |
|
#define __S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask)) |
85 |
|
#define S_ISDIR(mode) __S_ISTYPE((mode), S_IFDIR) |
86 |
|
#define S_ISREG(mode) __S_ISTYPE((mode), S_IFREG) |
87 |
|
|
88 |
|
#define DT_DIR 4 |
89 |
|
#define DT_REG 8 |
90 |
|
|
91 |
|
int stat(const char *path, struct stat *buf); |
92 |
|
|
93 |
|
#define FTW_F 0x01 |
94 |
|
#define FTW_D 0x02 |
95 |
|
#define FTW_DNR 0x03 |
96 |
|
#define FTW_NS 0x04 |
97 |
|
#define FTW_SL 0x05 |
98 |
|
|
99 |
|
#ifdef __cplusplus |
100 |
|
} |
101 |
|
#endif |
102 |
|
|
103 |
|
#endif |
104 |
|
/* end of POSIX WIN32 Directory Browsing implementation */ |
105 |
|
|
106 |
#else |
#else |
107 |
#include <sys/stat.h> |
#include <sys/stat.h> |
108 |
#endif |
#endif |
176 |
static std::vector<DirectoryWalker*> DirectoryWalkers; |
static std::vector<DirectoryWalker*> DirectoryWalkers; |
177 |
static std::string DWErrorMsg; |
static std::string DWErrorMsg; |
178 |
|
|
|
#if WIN32 |
|
|
|
|
|
#else |
|
179 |
struct stat Status; |
struct stat Status; |
180 |
static int FtwCallback(const char* fpath, const struct stat* sb, int typeflag); |
static int FtwCallback(const char* fpath, const struct stat* sb, int typeflag); |
|
#endif |
|
181 |
}; |
}; |
182 |
} |
} |
183 |
|
|