MCPcopy Create free account
hub / github.com/Snapchat/Valdi / remove

Method remove

valdi_core/src/valdi_core/cpp/Utils/DiskUtils.cpp:206–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206bool DiskUtils::remove(const Path& path) {
207 auto pathStr = path.toString();
208 auto stat = statFromPath(pathStr.c_str());
209
210 if (stat.isDir()) {
211 auto content = DiskUtils::listDirectory(path);
212 for (const auto& file : content) {
213 if (!remove(file)) {
214 return false;
215 }
216 }
217 }
218
219 return std::remove(pathStr.c_str()) >= 0;
220}
221
222std::vector<Path> DiskUtils::listDirectory(const Path& path) {
223 auto pathStr = path.toString();

Callers

nothing calls this directly

Calls 4

statFromPathFunction · 0.85
isDirMethod · 0.80
toStringMethod · 0.65
removeFunction · 0.50

Tested by

no test coverage detected