- struct dirent* ent;
- while(readdir_r(d, ent, &ent) == 0 && ent) {
- if (ent->d_type & DT_DIR) {
- if (strcmp(ent->d_name, ".") && strcmp(ent->d_name, ".."))
- log.warn("nested folders not supported, skipping (%s)", ent->d_name);
+ char dir_buf[sizeof(struct dirent) + PATH_MAX];
+ struct dirent* ent = (struct dirent*)dir_buf;
+ struct dirent* entptr = nullptr;
+ while(readdir_r(d, ent, &entptr) == 0 && entptr) {
+ if (!strcmp(entptr->d_name, ".") || !strcmp(entptr->d_name, ".."))
+ continue;
+ fullname = loc + '/' + entptr->d_name;
+ struct stat stat_buf;
+ if (stat(fullname.c_str(), &stat_buf) != 0) {
+ log.warn("unable to access (%s)", entptr->d_name);
+ continue;
+ }
+ else if (S_ISDIR(stat_buf.st_mode)) {
+ log.warn("nested folders not supported, skipping (%s)", entptr->d_name);