1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +01:00

Use varg template for Path::Combine

This commit is contained in:
Ted John
2017-06-05 17:46:17 +01:00
parent 9a619b3e0a
commit 2d00b1e8aa
2 changed files with 7 additions and 10 deletions

View File

@@ -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());

View File

@@ -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<typename... Args>
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);