| 260 | |
| 261 | while (struct dirent *f = readdir(dir)) |
| 262 | { |
| 263 | if (f->d_name[0] == '.') |
| 264 | continue; |
| 265 | |
| 266 | std::string path = base + f->d_name; |
| 267 | |
| 268 | unsigned char d_type = f->d_type; |
| 269 | if (d_type == DT_UNKNOWN) |
| 270 | { |
| 271 | kt_stat64_t st{}; |
| 272 | if (kt_stat64(path.c_str(), &st) == 0) |
| 273 | { |
| 274 | if (S_ISDIR(st.st_mode)) |
| 275 | d_type = DT_DIR; |
| 276 | else if (S_ISREG(st.st_mode)) |
| 277 | d_type = DT_REG; |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | if (d_type == DT_DIR) |
| 282 | { |
| 283 | if (listFilesCallback(path, cb)) |
| 284 | { |
| 285 | closedir(dir); |
| 286 | return true; |
| 287 | } |
| 288 | } |
| 289 | else if (d_type == DT_REG) |
| 290 | { |
| 291 | if (cb && cb(path)) |
| 292 | { |
| 293 | closedir(dir); |
nothing calls this directly
no outgoing calls
no test coverage detected