MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / listDirectory

Function listDirectory

TactilityCore/Source/file/File.cpp:67–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67bool listDirectory(
68 const std::string& path,
69 std::function<void(const dirent&)> onEntry
70) {
71 auto lock = getLock(path)->asScopedLock();
72 lock.lock();
73
74 LOGGER.info("listDir start {}", path);
75 DIR* dir = opendir(path.c_str());
76 if (dir == nullptr) {
77 LOGGER.error("Failed to open dir {}", path);
78 return false;
79 }
80
81 dirent* current_entry;
82 while ((current_entry = readdir(dir)) != nullptr) {
83 onEntry(*current_entry);
84 }
85
86 closedir(dir);
87
88 LOGGER.info("listDir stop {}", path);
89 return true;
90}
91
92int scandir(
93 const std::string& path,

Callers 2

registerInstalledAppsFunction · 0.85
copyDirectoryFunction · 0.85

Calls 5

getLockFunction · 0.85
asScopedLockMethod · 0.80
infoMethod · 0.80
errorMethod · 0.80
lockMethod · 0.45

Tested by

no test coverage detected