| 148 | } |
| 149 | |
| 150 | std::string Path::DoJoin(const std::string** paths, size_t size) |
| 151 | { |
| 152 | std::string result = *paths[0]; |
| 153 | for (size_t i = 1; i < size; ++i) { |
| 154 | const std::string& path = *paths[i]; |
| 155 | if (!path.empty()) { |
| 156 | if (path[0] == '/') { |
| 157 | result = path; |
| 158 | } else { |
| 159 | if (!result.empty() && result[result.size() - 1] != '/') |
| 160 | result += '/'; |
| 161 | result += path; |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | return result; |
| 166 | } |
| 167 | |
| 168 | } // namespace toft |
| 169 |