[Base] Join paths better.

[Base] Join paths better, so the first iteration isn't a join of an empty
string with the first path part.
This commit is contained in:
gibbed 2020-04-20 00:29:43 -05:00 committed by Rick Gibbed
parent 85dbb9d451
commit 817d87a0a7
1 changed files with 6 additions and 2 deletions

View File

@ -500,8 +500,12 @@ std::string join_paths(const std::string_view left_path,
std::string join_paths(std::vector<std::string_view> paths, char32_t sep) {
std::string result;
for (const auto& path : paths) {
result = join_paths(result, path, sep);
auto it = paths.cbegin();
if (it != paths.cend()) {
result = *it++;
for (; it != paths.cend(); ++it) {
result = join_paths(result, *it, sep);
}
}
return result;
}