1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Rename PATHID and its members

This commit is contained in:
Gymnasiast
2025-03-25 23:57:36 +01:00
parent e6762f1e08
commit 74758c77b6
10 changed files with 53 additions and 53 deletions

View File

@@ -196,7 +196,7 @@ void ShortcutManager::LoadUserBindings()
{
try
{
auto path = fs::u8path(_env->GetFilePath(PATHID::CONFIG_SHORTCUTS));
auto path = fs::u8path(_env->GetFilePath(PathId::configShortcuts));
if (fs::exists(path))
{
LoadUserBindings(path);
@@ -206,7 +206,7 @@ void ShortcutManager::LoadUserBindings()
try
{
Console::WriteLine("Importing legacy shortcuts...");
auto legacyPath = fs::u8path(_env->GetFilePath(PATHID::CONFIG_SHORTCUTS_LEGACY));
auto legacyPath = fs::u8path(_env->GetFilePath(PathId::configShortcutsLegacy));
if (fs::exists(legacyPath))
{
LoadLegacyBindings(legacyPath);
@@ -317,7 +317,7 @@ void ShortcutManager::SaveUserBindings()
{
try
{
auto path = fs::u8path(_env->GetFilePath(PATHID::CONFIG_SHORTCUTS));
auto path = fs::u8path(_env->GetFilePath(PathId::configShortcuts));
SaveUserBindings(path);
}
catch (const std::exception& e)

View File

@@ -61,7 +61,7 @@ namespace OpenRCT2::Ui::Windows
/**
* @brief Retrieves the changelog contents.
*/
const std::string GetText(PATHID pathId)
const std::string GetText(PathId pathId)
{
auto env = GetContext()->GetPlatformEnvironment();
auto path = env->GetFilePath(pathId);
@@ -99,7 +99,7 @@ namespace OpenRCT2::Ui::Windows
return true;
case WV_CHANGELOG:
if (!ReadFile(PATHID::CHANGELOG))
if (!ReadFile(PathId::changelog))
{
return false;
}
@@ -108,7 +108,7 @@ namespace OpenRCT2::Ui::Windows
return true;
case WV_CONTRIBUTORS:
if (!ReadFile(PATHID::CONTRIBUTORS))
if (!ReadFile(PathId::contributors))
{
return false;
}
@@ -246,14 +246,14 @@ namespace OpenRCT2::Ui::Windows
std::string GetChangelogPath()
{
auto env = GetContext()->GetPlatformEnvironment();
return env->GetFilePath(PATHID::CHANGELOG);
return env->GetFilePath(PathId::changelog);
}
/**
* @brief Attempts to read the changelog file, returns true on success
*
*/
bool ReadFile(PATHID pathId)
bool ReadFile(PathId pathId)
{
std::string _text;
try

View File

@@ -123,7 +123,7 @@ public:
return Path::Combine(basePath, directoryName);
}
u8string GetFilePath(PATHID pathid) const override
u8string GetFilePath(PathId pathid) const override
{
auto dirbase = GetDefaultBaseDirectory(pathid);
auto basePath = GetDirectoryPath(dirbase);
@@ -178,28 +178,28 @@ public:
}
private:
static DirBase GetDefaultBaseDirectory(PATHID pathid)
static DirBase GetDefaultBaseDirectory(PathId pathid)
{
switch (pathid)
{
case PATHID::CONFIG:
case PATHID::CONFIG_SHORTCUTS_LEGACY:
case PATHID::CONFIG_SHORTCUTS:
case PathId::config:
case PathId::configShortcutsLegacy:
case PathId::configShortcuts:
return DirBase::config;
case PATHID::CACHE_OBJECTS:
case PATHID::CACHE_TRACKS:
case PATHID::CACHE_SCENARIOS:
case PathId::cacheObjects:
case PathId::cacheTracks:
case PathId::cacheScenarios:
return DirBase::cache;
case PATHID::SCORES_RCT2:
case PathId::scoresRCT2:
return DirBase::rct2;
case PATHID::CHANGELOG:
case PATHID::CONTRIBUTORS:
case PathId::changelog:
case PathId::contributors:
return DirBase::documentation;
case PATHID::NETWORK_GROUPS:
case PATHID::NETWORK_SERVERS:
case PATHID::NETWORK_USERS:
case PATHID::SCORES:
case PATHID::SCORES_LEGACY:
case PathId::networkGroups:
case PathId::networkServers:
case PathId::networkUsers:
case PathId::scores:
case PathId::scoresLegacy:
default:
return DirBase::user;
}
@@ -260,7 +260,7 @@ std::unique_ptr<IPlatformEnvironment> OpenRCT2::CreatePlatformEnvironment()
auto env = OpenRCT2::CreatePlatformEnvironment(basePaths);
// Now load the config so we can get the RCT1 and RCT2 paths
auto configPath = env->GetFilePath(PATHID::CONFIG);
auto configPath = env->GetFilePath(PathId::config);
Config::SetDefaults();
if (!Config::OpenFromPath(configPath))
{

View File

@@ -54,23 +54,23 @@ namespace OpenRCT2
scenarioPatches, // Contains scenario patches.
};
enum class PATHID
enum class PathId
{
CONFIG, // Main configuration (config.ini).
CONFIG_SHORTCUTS_LEGACY, // Old keyboard shortcuts (hotkeys.cfg)
CONFIG_SHORTCUTS, // Shortcut bindings (shortcuts.json)
CACHE_OBJECTS, // Object repository cache (objects.idx).
CACHE_TRACKS, // Track repository cache (tracks.idx).
CACHE_SCENARIOS, // Scenario repository cache (scenarios.idx).
NETWORK_GROUPS, // Server groups with permissions (groups.json).
NETWORK_SERVERS, // Saved servers (servers.cfg).
NETWORK_USERS, // Users and their groups (users.json).
SCORES, // Scenario scores (highscores.dat).
SCORES_LEGACY, // Scenario scores, legacy (scores.dat).
SCORES_RCT2, // Scenario scores, rct2 (\Saved Games\scores.dat).
CHANGELOG, // Notable changes to the game between versions, distributed with the game.
PLUGIN_STORE, // Shared storage for plugins.
CONTRIBUTORS, // Who has provided work to the game (Contributors.md).
config, // Main configuration (config.ini).
configShortcutsLegacy, // Old keyboard shortcuts (hotkeys.cfg)
configShortcuts, // Shortcut bindings (shortcuts.json)
cacheObjects, // Object repository cache (objects.idx).
cacheTracks, // Track repository cache (tracks.idx).
cacheScenarios, // Scenario repository cache (scenarios.idx).
networkGroups, // Server groups with permissions (groups.json).
networkServers, // Saved servers (servers.cfg).
networkUsers, // Users and their groups (users.json).
scores, // Scenario scores (highscores.dat).
scoresLegacy, // Scenario scores, legacy (scores.dat).
scoresRCT2, // Scenario scores, rct2 (\Saved Games\scores.dat).
changelog, // Notable changes to the game between versions, distributed with the game.
pluginStore, // Shared storage for plugins.
contributors, // Who has provided work to the game (Contributors.md).
};
/**
@@ -82,7 +82,7 @@ namespace OpenRCT2
virtual u8string GetDirectoryPath(DirBase base) const = 0;
virtual u8string GetDirectoryPath(DirBase base, DirId did) const = 0;
virtual u8string GetFilePath(PATHID pathid) const = 0;
virtual u8string GetFilePath(PathId pathid) const = 0;
virtual u8string FindFile(DirBase base, DirId did, u8string_view fileName) const = 0;
virtual void SetBasePath(DirBase base, u8string_view path) = 0;
virtual bool IsUsingClassic() const = 0;

View File

@@ -373,7 +373,7 @@ static exitcode_t HandleCommandSetRCT2(CommandLineArgEnumerator* enumerator)
// Update RCT2 path in config
auto env = OpenRCT2::CreatePlatformEnvironment();
auto configPath = env->GetFilePath(OpenRCT2::PATHID::CONFIG);
auto configPath = env->GetFilePath(OpenRCT2::PathId::config);
Config::SetDefaults();
Config::OpenFromPath(configPath);
Config::Get().general.RCT2Path = path;

View File

@@ -190,7 +190,7 @@ std::vector<ServerListEntry> ServerList::ReadFavourites() const
try
{
auto env = GetContext()->GetPlatformEnvironment();
auto path = env->GetFilePath(PATHID::NETWORK_SERVERS);
auto path = env->GetFilePath(PathId::networkServers);
if (File::Exists(path))
{
auto fs = FileStream(path, FileMode::open);

View File

@@ -84,7 +84,7 @@ private:
public:
explicit ObjectFileIndex(IObjectRepository& objectRepository, const IPlatformEnvironment& env)
: FileIndex(
"object index", kMagicNumber, kVersion, env.GetFilePath(PATHID::CACHE_OBJECTS), std::string(kPattern),
"object index", kMagicNumber, kVersion, env.GetFilePath(PathId::cacheObjects), std::string(kPattern),
std::vector<std::string>{
env.GetDirectoryPath(DirBase::openrct2, DirId::objects),
env.GetDirectoryPath(DirBase::user, DirId::objects),

View File

@@ -62,7 +62,7 @@ private:
public:
explicit TrackDesignFileIndex(const IPlatformEnvironment& env)
: FileIndex(
"track design index", kMagicNumber, kVersion, env.GetFilePath(PATHID::CACHE_TRACKS), std::string(kPattern),
"track design index", kMagicNumber, kVersion, env.GetFilePath(PathId::cacheTracks), std::string(kPattern),
std::vector<std::string>({
env.GetDirectoryPath(DirBase::rct1, DirId::trackDesigns),
env.GetDirectoryPath(DirBase::rct2, DirId::trackDesigns),

View File

@@ -130,7 +130,7 @@ private:
public:
explicit ScenarioFileIndex(const IPlatformEnvironment& env)
: FileIndex(
"scenario index", kMagicNumber, kVersion, env.GetFilePath(PATHID::CACHE_SCENARIOS), std::string(kPattern),
"scenario index", kMagicNumber, kVersion, env.GetFilePath(PathId::cacheScenarios), std::string(kPattern),
std::vector<std::string>({
env.GetDirectoryPath(DirBase::rct1, DirId::scenarios),
env.GetDirectoryPath(DirBase::rct2, DirId::scenarios),
@@ -526,7 +526,7 @@ private:
void LoadScores()
{
std::string path = _env->GetFilePath(PATHID::SCORES);
std::string path = _env->GetFilePath(PathId::scores);
if (!File::Exists(path))
{
return;
@@ -566,8 +566,8 @@ private:
*/
void LoadLegacyScores()
{
std::string rct2Path = _env->GetFilePath(PATHID::SCORES_RCT2);
std::string legacyPath = _env->GetFilePath(PATHID::SCORES_LEGACY);
std::string rct2Path = _env->GetFilePath(PathId::scoresRCT2);
std::string legacyPath = _env->GetFilePath(PathId::scoresLegacy);
LoadLegacyScores(legacyPath);
LoadLegacyScores(rct2Path);
}
@@ -670,7 +670,7 @@ private:
void SaveHighscores()
{
std::string path = _env->GetFilePath(PATHID::SCORES);
std::string path = _env->GetFilePath(PathId::scores);
try
{
auto fs = FileStream(path, FileMode::write);

View File

@@ -1573,7 +1573,7 @@ void ScriptEngine::LoadSharedStorage()
{
InitSharedStorage();
auto path = _env.GetFilePath(PATHID::PLUGIN_STORE);
auto path = _env.GetFilePath(PathId::pluginStore);
try
{
if (File::Exists(path))
@@ -1595,7 +1595,7 @@ void ScriptEngine::LoadSharedStorage()
void ScriptEngine::SaveSharedStorage()
{
auto path = _env.GetFilePath(PATHID::PLUGIN_STORE);
auto path = _env.GetFilePath(PathId::pluginStore);
try
{
_sharedStorage.push();