From 2d00b1e8aa3940f4c6dd5296d5f808cc6c9bca5d Mon Sep 17 00:00:00 2001 From: Ted John Date: Mon, 5 Jun 2017 17:46:17 +0100 Subject: [PATCH] Use varg template for Path::Combine --- src/openrct2/core/Path.cpp | 9 --------- src/openrct2/core/Path.hpp | 8 +++++++- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/openrct2/core/Path.cpp b/src/openrct2/core/Path.cpp index 0ebf77e268..81c299686f 100644 --- a/src/openrct2/core/Path.cpp +++ b/src/openrct2/core/Path.cpp @@ -42,15 +42,6 @@ namespace Path return std::string(buffer); } - std::string Combine(const std::string &a, const std::string &b, const std::string &c) - { - utf8 buffer[MAX_PATH]; - String::Set(buffer, sizeof(buffer), a.c_str()); - Path::Append(buffer, sizeof(buffer), b.c_str()); - Path::Append(buffer, sizeof(buffer), c.c_str()); - return std::string(buffer); - } - std::string GetDirectory(const std::string &path) { const utf8* directory = GetDirectory(path.c_str()); diff --git a/src/openrct2/core/Path.hpp b/src/openrct2/core/Path.hpp index 1ed29c8aea..807f5adf57 100644 --- a/src/openrct2/core/Path.hpp +++ b/src/openrct2/core/Path.hpp @@ -23,7 +23,13 @@ namespace Path { utf8 * Append(utf8 * buffer, size_t bufferSize, const utf8 * src); std::string Combine(const std::string &a, const std::string &b); - std::string Combine(const std::string &a, const std::string &b, const std::string &c); + + template + std::string Combine(const std::string &a, const std::string &b, Args... args) + { + return Combine(a, Combine(b, args...)); + } + std::string GetDirectory(const std::string &path); utf8 * GetDirectory(const utf8 * path); utf8 * GetDirectory(utf8 * buffer, size_t bufferSize, const utf8 * path);