| 110 | } |
| 111 | |
| 112 | std::string GetAbstractPathExtension(const std::string& s) { |
| 113 | std::string_view basename(s); |
| 114 | auto offset = basename.find_last_of(kSep); |
| 115 | if (offset != std::string::npos) { |
| 116 | basename = basename.substr(offset); |
| 117 | } |
| 118 | auto dot = basename.find_last_of('.'); |
| 119 | if (dot == std::string_view::npos) { |
| 120 | // Empty extension |
| 121 | return ""; |
| 122 | } |
| 123 | return std::string(basename.substr(dot + 1)); |
| 124 | } |
| 125 | |
| 126 | Status ValidateAbstractPathParts(const std::vector<std::string>& parts) { |
| 127 | for (const auto& part : parts) { |