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
262void KittyIOFile::listFilesCallback(const std::string &dirPath, std::function<bool(const std::string &)> cb)
263{
264 DIR *dir = opendir(dirPath.c_str());
265 if (!dir)
266 return;
267
268 std::string base = dirPath;
269 if (!base.empty() && base.back() != '/')
270 base += '/';
271
272 while (struct dirent *f = readdir(dir))
273 {
274 if (f->d_name[0] == '.')
275 continue;
276
277 std::string path = base + f->d_name;
278 if (f->d_type == DT_DIR)
279 {
280 listFilesCallback(path, cb);
281 }
282 else if (f->d_type == DT_REG)
283 {
284 if (cb && cb(path))
285 break;
286 }
287 }
288
289 closedir(dir);
290}
291
292bool KittyIOFile::createDirectoryRecursive(const std::string &path, mode_t mode)
293{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected