MCPcopy Create free account
hub / github.com/MJx0/KittyMemoryEx / listFilesCallback

Method listFilesCallback

KittyMemoryEx/KittyIOFile.cpp:262–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected