diff --git a/src/openrct2-ui/input/ShortcutManager.cpp b/src/openrct2-ui/input/ShortcutManager.cpp index 9328b3a797..eaeff43e32 100644 --- a/src/openrct2-ui/input/ShortcutManager.cpp +++ b/src/openrct2-ui/input/ShortcutManager.cpp @@ -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) diff --git a/src/openrct2-ui/windows/Changelog.cpp b/src/openrct2-ui/windows/Changelog.cpp index 71a2aed8e1..e21c53512d 100644 --- a/src/openrct2-ui/windows/Changelog.cpp +++ b/src/openrct2-ui/windows/Changelog.cpp @@ -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 diff --git a/src/openrct2/PlatformEnvironment.cpp b/src/openrct2/PlatformEnvironment.cpp index a8c49ddc8a..d079e58f7b 100644 --- a/src/openrct2/PlatformEnvironment.cpp +++ b/src/openrct2/PlatformEnvironment.cpp @@ -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 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)) { diff --git a/src/openrct2/PlatformEnvironment.h b/src/openrct2/PlatformEnvironment.h index 8ffedb63a8..99f1abb24c 100644 --- a/src/openrct2/PlatformEnvironment.h +++ b/src/openrct2/PlatformEnvironment.h @@ -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; diff --git a/src/openrct2/command_line/RootCommands.cpp b/src/openrct2/command_line/RootCommands.cpp index d9325ae468..4f5b964c43 100644 --- a/src/openrct2/command_line/RootCommands.cpp +++ b/src/openrct2/command_line/RootCommands.cpp @@ -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; diff --git a/src/openrct2/network/ServerList.cpp b/src/openrct2/network/ServerList.cpp index a8c72bdfd7..3670d0ad30 100644 --- a/src/openrct2/network/ServerList.cpp +++ b/src/openrct2/network/ServerList.cpp @@ -190,7 +190,7 @@ std::vector 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); diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index e12322a095..2fe05c3b04 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -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{ env.GetDirectoryPath(DirBase::openrct2, DirId::objects), env.GetDirectoryPath(DirBase::user, DirId::objects), diff --git a/src/openrct2/ride/TrackDesignRepository.cpp b/src/openrct2/ride/TrackDesignRepository.cpp index 47e83827e5..6a5877f89c 100644 --- a/src/openrct2/ride/TrackDesignRepository.cpp +++ b/src/openrct2/ride/TrackDesignRepository.cpp @@ -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({ env.GetDirectoryPath(DirBase::rct1, DirId::trackDesigns), env.GetDirectoryPath(DirBase::rct2, DirId::trackDesigns), diff --git a/src/openrct2/scenario/ScenarioRepository.cpp b/src/openrct2/scenario/ScenarioRepository.cpp index 1dece4a764..610c6c7bcc 100644 --- a/src/openrct2/scenario/ScenarioRepository.cpp +++ b/src/openrct2/scenario/ScenarioRepository.cpp @@ -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({ 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); diff --git a/src/openrct2/scripting/ScriptEngine.cpp b/src/openrct2/scripting/ScriptEngine.cpp index 144e839104..919c5ed3b6 100644 --- a/src/openrct2/scripting/ScriptEngine.cpp +++ b/src/openrct2/scripting/ScriptEngine.cpp @@ -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();