MCPcopy Create free account
hub / github.com/apache/arrow / MinimalCreateDirSet

Function MinimalCreateDirSet

cpp/src/arrow/filesystem/path_util.cc:286–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286std::vector<std::string> MinimalCreateDirSet(std::vector<std::string> dirs) {
287 std::sort(dirs.begin(), dirs.end());
288
289 for (auto ancestor = dirs.begin(); ancestor != dirs.end(); ++ancestor) {
290 auto descendant = ancestor;
291 auto descendants_end = descendant + 1;
292
293 while (descendants_end != dirs.end() && IsAncestorOf(*descendant, *descendants_end)) {
294 ++descendant;
295 ++descendants_end;
296 }
297
298 ancestor = dirs.erase(ancestor, descendants_end - 1);
299 }
300
301 // the root directory need not be created
302 if (dirs.size() == 1 && IsAncestorOf(dirs[0], "")) {
303 return {};
304 }
305
306 return dirs;
307}
308
309std::string ToBackslashes(std::string_view v) {
310 std::string s(v);

Callers 2

CopyFilesFunction · 0.85
TESTFunction · 0.85

Calls 4

IsAncestorOfFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by 1

TESTFunction · 0.68