| 284 | } |
| 285 | |
| 286 | std::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 | |
| 309 | std::string ToBackslashes(std::string_view v) { |
| 310 | std::string s(v); |