| 85 | } |
| 86 | |
| 87 | int GetAbstractPathDepth(std::string_view path) { |
| 88 | if (path.empty()) { |
| 89 | return 0; |
| 90 | } |
| 91 | int depth = static_cast<int>(std::count(path.begin(), path.end(), kSep)) + 1; |
| 92 | if (path.back() == kSep) { |
| 93 | depth -= 1; |
| 94 | } |
| 95 | if (path.front() == kSep) { |
| 96 | depth -= 1; |
| 97 | } |
| 98 | return depth; |
| 99 | } |
| 100 | |
| 101 | std::pair<std::string, std::string> GetAbstractPathParent(const std::string& s) { |
| 102 | // XXX should strip trailing slash? |