| 457 | } |
| 458 | |
| 459 | std::size_t countPathComponents(const std::string& path) |
| 460 | { |
| 461 | bool was_component = false; |
| 462 | std::size_t count = 0; |
| 463 | |
| 464 | for (std::size_t i = 0; i < path.size(); ++i) { |
| 465 | const char c = path[i]; |
| 466 | |
| 467 | if (c == '/') { |
| 468 | if (was_component) { |
| 469 | ++count; |
| 470 | was_component = false; |
| 471 | } |
| 472 | } |
| 473 | else { |
| 474 | was_component = true; |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | return count; |
| 479 | } |
| 480 | |
| 481 | std::string normalizePath(const std::string& path) |
| 482 | { |
no outgoing calls
no test coverage detected