15 #if (defined(__GNUC__) || defined(__GCCXML__)) && !defined(_WIN32)
34 long _findfirst(
const char *name, _finddata_t *f)
40 const char* lastSep = strrchr(name,
'/');
51 unsigned sepIndex = lastSep - name;
55 DIR* dir = opendir(nameCopy);
61 fi->dirName = nameCopy;
65 long ret = fileInfo.
Size()-1;
69 if (_findnext(ret, f) == -1)
return -1;
103 int _findnext(
long h, _finddata_t *f)
106 if (h < 0 || h >= (
long)fileInfo.
Size())
return -1;
108 _findinfo_t* fi = fileInfo[h];
112 dirent* entry = readdir(fi->openedDir);
113 if(entry == 0)
return -1;
116 if (fnmatch(fi->filter, entry->d_name, FNM_PATHNAME) != 0)
continue;
121 struct stat filestat;
123 if (stat(fullPath, &filestat) != 0)
129 if (S_ISREG(filestat.st_mode))
131 f->attrib = _A_NORMAL;
132 }
else if (S_ISDIR(filestat.st_mode))
134 f->attrib = _A_SUBDIR;
139 f->size = filestat.st_size;
140 strncpy_s(f->name, entry->d_name, STRING_BUFFER_SIZE);
155 int _findclose(
long h)
159 if (h < 0 || h >= (
long)fileInfo.
Size())
165 _findinfo_t* fi = fileInfo[h];
166 closedir(fi->openedDir);