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

Method makeDirectory

valdi_core/src/valdi_core/cpp/Utils/DiskUtils.cpp:194–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194bool DiskUtils::makeDirectory(const Path& path, bool createIntermediates) {
195 if (createIntermediates && path.getComponents().size() > 1) {
196 auto parentPath = path.removingLastComponent();
197 if (!isDirectory(parentPath) && !makeDirectory(path.removingLastComponent(), true)) {
198 return false;
199 }
200 }
201
202 auto pathStr = path.toString();
203 return mkdir(pathStr.c_str(), S_IRWXU | S_IRWXG | S_IRWXO) >= 0;
204}
205
206bool DiskUtils::remove(const Path& path) {
207 auto pathStr = path.toString();

Callers

nothing calls this directly

Calls 4

isDirectoryFunction · 0.85
toStringMethod · 0.65
sizeMethod · 0.45
removingLastComponentMethod · 0.45

Tested by

no test coverage detected