1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 07:43:01 +01:00

Add verbose logging of base paths

This commit is contained in:
Ted John
2017-06-06 17:02:45 +01:00
parent f3b4c88783
commit 2f053800ba
3 changed files with 16 additions and 6 deletions

View File

@@ -282,6 +282,13 @@ namespace OpenRCT2
basePaths[(size_t)DIRBASE::USER] = std::string(path); basePaths[(size_t)DIRBASE::USER] = std::string(path);
IPlatformEnvironment * env = CreatePlatformEnvironment(basePaths); IPlatformEnvironment * env = CreatePlatformEnvironment(basePaths);
// Log base paths
log_verbose("DIRBASE::RCT1 : %s", env->GetDirectoryPath(DIRBASE::RCT1).c_str());
log_verbose("DIRBASE::RCT2 : %s", env->GetDirectoryPath(DIRBASE::RCT2).c_str());
log_verbose("DIRBASE::OPENRCT2: %s", env->GetDirectoryPath(DIRBASE::OPENRCT2).c_str());
log_verbose("DIRBASE::USER : %s", env->GetDirectoryPath(DIRBASE::USER).c_str());
return env; return env;
} }

View File

@@ -25,7 +25,7 @@ extern "C"
#include "platform/platform.h" #include "platform/platform.h"
} }
class PlatformEnvironment : public IPlatformEnvironment class PlatformEnvironment final : public IPlatformEnvironment
{ {
private: private:
std::string _basePath[DIRBASE_COUNT]; std::string _basePath[DIRBASE_COUNT];
@@ -39,9 +39,14 @@ public:
} }
} }
std::string GetDirectoryPath(DIRBASE base) const override
{
return _basePath[(size_t)base];
}
std::string GetDirectoryPath(DIRBASE base, DIRID did) const override std::string GetDirectoryPath(DIRBASE base, DIRID did) const override
{ {
const utf8 * basePath = _basePath[(size_t)base].c_str(); auto basePath = GetDirectoryPath(base);
const utf8 * directoryName; const utf8 * directoryName;
switch (base) { switch (base) {
default: default:
@@ -55,10 +60,7 @@ public:
break; break;
} }
utf8 path[260]; return Path::Combine(basePath, directoryName);
String::Set(path, sizeof(path), basePath);
Path::Append(path, sizeof(path), directoryName);
return std::string(path);
} }
std::string GetFilePath(PATHID pathid) const override std::string GetFilePath(PATHID pathid) const override

View File

@@ -68,6 +68,7 @@ interface IPlatformEnvironment
{ {
virtual ~IPlatformEnvironment() = default; virtual ~IPlatformEnvironment() = default;
virtual std::string GetDirectoryPath(DIRBASE base) const abstract;
virtual std::string GetDirectoryPath(DIRBASE base, DIRID did) const abstract; virtual std::string GetDirectoryPath(DIRBASE base, DIRID did) const abstract;
virtual std::string GetFilePath(PATHID pathid) const abstract; virtual std::string GetFilePath(PATHID pathid) const abstract;
}; };