[Base] Plain string variant of UTF-8 join_paths.

This commit is contained in:
gibbed 2021-05-02 08:12:14 -05:00 committed by Rick Gibbed
parent 46dfb3449c
commit b7674f0bd8
2 changed files with 24 additions and 3 deletions
src/xenia/base

View File

@ -490,7 +490,20 @@ std::string join_paths(const std::string_view left_path,
return result + std::string(right_path);
}
std::string join_paths(std::vector<std::string_view> paths,
std::string join_paths(const std::vector<std::string>& paths,
char32_t separator) {
std::string result;
auto it = paths.cbegin();
if (it != paths.cend()) {
result = *it++;
for (; it != paths.cend(); ++it) {
result = join_paths(result, *it, separator);
}
}
return result;
}
std::string join_paths(const std::vector<std::string_view>& paths,
char32_t separator) {
std::string result;
auto it = paths.cbegin();

View File

@ -68,7 +68,10 @@ std::string join_paths(const std::string_view left_path,
const std::string_view right_path,
char32_t separator = kPathSeparator);
std::string join_paths(std::vector<std::string_view> paths,
std::string join_paths(const std::vector<std::string>& paths,
char32_t separator = kPathSeparator);
std::string join_paths(const std::vector<std::string_view>& paths,
char32_t separator = kPathSeparator);
inline std::string join_paths(
@ -86,7 +89,12 @@ inline std::string join_guest_paths(const std::string_view left_path,
return join_paths(left_path, right_path, kGuestPathSeparator);
}
inline std::string join_guest_paths(std::vector<std::string_view> paths) {
inline std::string join_guest_paths(const std::vector<std::string>& paths) {
return join_paths(paths, kGuestPathSeparator);
}
inline std::string join_guest_paths(
const std::vector<std::string_view>& paths) {
return join_paths(paths, kGuestPathSeparator);
}