| 148 | } |
| 149 | |
| 150 | std::string ConcatAbstractPath(std::string_view base, std::string_view stem) { |
| 151 | DCHECK(!stem.empty()); |
| 152 | if (base.empty()) { |
| 153 | return std::string{stem}; |
| 154 | } |
| 155 | std::string result; |
| 156 | result.reserve(base.length() + stem.length() + 1); // extra 1 is for potential kSep |
| 157 | result += EnsureTrailingSlash(base); |
| 158 | result += RemoveLeadingSlash(stem); |
| 159 | return result; |
| 160 | } |
| 161 | |
| 162 | std::string EnsureTrailingSlash(std::string_view v) { |
| 163 | if (!v.empty() && !HasTrailingSlash(v)) { |