diff --git a/src/xenia/base/utf8.cc b/src/xenia/base/utf8.cc index b30d8efa8..ae357c2b9 100644 --- a/src/xenia/base/utf8.cc +++ b/src/xenia/base/utf8.cc @@ -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 paths, +std::string join_paths(const std::vector& 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& paths, char32_t separator) { std::string result; auto it = paths.cbegin(); diff --git a/src/xenia/base/utf8.h b/src/xenia/base/utf8.h index 8a1f06056..9e15706ed 100644 --- a/src/xenia/base/utf8.h +++ b/src/xenia/base/utf8.h @@ -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 paths, +std::string join_paths(const std::vector& paths, + char32_t separator = kPathSeparator); + +std::string join_paths(const std::vector& 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 paths) { +inline std::string join_guest_paths(const std::vector& paths) { + return join_paths(paths, kGuestPathSeparator); +} + +inline std::string join_guest_paths( + const std::vector& paths) { return join_paths(paths, kGuestPathSeparator); }