MCPcopy Create free account
hub / github.com/ModOrganizer2/modorganizer / getFilesAndDirs

Function getFilesAndDirs

src/envfs.cpp:365–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

363}
364
365Directory getFilesAndDirs(const std::wstring& path)
366{
367 struct Context
368 {
369 std::stack<Directory*> current;
370 };
371
372 Directory root;
373
374 Context cx;
375 cx.current.push(&root);
376
377 env::forEachEntry(
378 path, &cx,
379 [](void* pcx, std::wstring_view path) {
380 Context* cx = (Context*)pcx;
381
382 cx->current.top()->dirs.push_back(Directory(path));
383 cx->current.push(&cx->current.top()->dirs.back());
384 },
385
386 [](void* pcx, std::wstring_view path) {
387 Context* cx = (Context*)pcx;
388 cx->current.pop();
389 },
390
391 [](void* pcx, std::wstring_view path, FILETIME ft, uint64_t s) {
392 Context* cx = (Context*)pcx;
393
394 cx->current.top()->files.push_back(File(path, ft, s));
395 });
396
397 return root;
398}
399
400File::File(std::wstring_view n, FILETIME ft, uint64_t s)
401 : name(n.begin(), n.end()), lcname(MOShared::ToLowerCopy(name)), lastModified(ft),

Callers

nothing calls this directly

Calls 4

forEachEntryFunction · 0.85
backMethod · 0.80
DirectoryClass · 0.70
FileClass · 0.70

Tested by

no test coverage detected