diff --git a/src/openrct2/PlatformEnvironment.cpp b/src/openrct2/PlatformEnvironment.cpp index d079e58f7b..867ea5260f 100644 --- a/src/openrct2/PlatformEnvironment.cpp +++ b/src/openrct2/PlatformEnvironment.cpp @@ -227,9 +227,9 @@ std::unique_ptr OpenRCT2::CreatePlatformEnvironment() // Set default paths std::string basePaths[kDirBaseCount]; basePaths[EnumValue(DirBase::openrct2)] = Platform::GetInstallPath(); - basePaths[EnumValue(DirBase::user)] = Path::Combine(Platform::GetFolderPath(SPECIAL_FOLDER::USER_DATA), subDirectory); - basePaths[EnumValue(DirBase::config)] = Path::Combine(Platform::GetFolderPath(SPECIAL_FOLDER::USER_CONFIG), subDirectory); - basePaths[EnumValue(DirBase::cache)] = Path::Combine(Platform::GetFolderPath(SPECIAL_FOLDER::USER_CACHE), subDirectory); + basePaths[EnumValue(DirBase::user)] = Path::Combine(Platform::GetFolderPath(SpecialFolder::userData), subDirectory); + basePaths[EnumValue(DirBase::config)] = Path::Combine(Platform::GetFolderPath(SpecialFolder::userConfig), subDirectory); + basePaths[EnumValue(DirBase::cache)] = Path::Combine(Platform::GetFolderPath(SpecialFolder::userCache), subDirectory); basePaths[EnumValue(DirBase::documentation)] = Platform::GetDocsPath(); // Override paths that have been specified via the command line diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index 7480aa1f32..6e7264e85a 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -755,7 +755,7 @@ namespace OpenRCT2::Config } } - auto discordPath = Platform::GetFolderPath(SPECIAL_FOLDER::RCT2_DISCORD); + auto discordPath = Platform::GetFolderPath(SpecialFolder::rct2Discord); if (!discordPath.empty() && Platform::OriginalGameDataExists(discordPath)) { return discordPath; @@ -777,7 +777,7 @@ namespace OpenRCT2::Config desc.Filters.emplace_back(LanguageGetString(STR_GOG_INSTALLER), "*.exe"); desc.Filters.emplace_back(LanguageGetString(STR_ALL_FILES), "*"); - const auto userHomePath = Platform::GetFolderPath(SPECIAL_FOLDER::USER_HOME); + const auto userHomePath = Platform::GetFolderPath(SpecialFolder::userHome); desc.InitialDirectory = userHomePath; return ContextOpenCommonFileDialog(desc); diff --git a/src/openrct2/platform/Platform.Android.cpp b/src/openrct2/platform/Platform.Android.cpp index 9734af5635..03197bbaac 100644 --- a/src/openrct2/platform/Platform.Android.cpp +++ b/src/openrct2/platform/Platform.Android.cpp @@ -35,15 +35,15 @@ static std::shared_ptr acl; namespace OpenRCT2::Platform { - std::string GetFolderPath(SPECIAL_FOLDER folder) + std::string GetFolderPath(SpecialFolder folder) { // Android builds currently only read from /sdcard/openrct2* switch (folder) { - case SPECIAL_FOLDER::USER_CACHE: - case SPECIAL_FOLDER::USER_CONFIG: - case SPECIAL_FOLDER::USER_DATA: - case SPECIAL_FOLDER::USER_HOME: + case SpecialFolder::userCache: + case SpecialFolder::userConfig: + case SpecialFolder::userData: + case SpecialFolder::userHome: return "/sdcard"; default: return std::string(); diff --git a/src/openrct2/platform/Platform.Linux.cpp b/src/openrct2/platform/Platform.Linux.cpp index 50c7597a02..379cd8a540 100644 --- a/src/openrct2/platform/Platform.Linux.cpp +++ b/src/openrct2/platform/Platform.Linux.cpp @@ -77,23 +77,23 @@ namespace OpenRCT2::Platform } } - std::string GetFolderPath(SPECIAL_FOLDER folder) + std::string GetFolderPath(SpecialFolder folder) { switch (folder) { - case SPECIAL_FOLDER::USER_CACHE: - case SPECIAL_FOLDER::USER_CONFIG: - case SPECIAL_FOLDER::USER_DATA: + case SpecialFolder::userCache: + case SpecialFolder::userConfig: + case SpecialFolder::userData: { auto path = GetEnvironmentPath("XDG_CONFIG_HOME"); if (path.empty()) { - auto home = GetFolderPath(SPECIAL_FOLDER::USER_HOME); + auto home = GetFolderPath(SpecialFolder::userHome); path = Path::Combine(home, u8".config"); } return path; } - case SPECIAL_FOLDER::USER_HOME: + case SpecialFolder::userHome: return GetHomePath(); default: return std::string(); diff --git a/src/openrct2/platform/Platform.Win32.cpp b/src/openrct2/platform/Platform.Win32.cpp index fa275c8296..2aa24c5c5f 100644 --- a/src/openrct2/platform/Platform.Win32.cpp +++ b/src/openrct2/platform/Platform.Win32.cpp @@ -90,23 +90,23 @@ namespace OpenRCT2::Platform return result; } - std::string GetFolderPath(SPECIAL_FOLDER folder) + std::string GetFolderPath(SpecialFolder folder) { switch (folder) { // We currently store everything under Documents/OpenRCT2 - case SPECIAL_FOLDER::USER_CACHE: - case SPECIAL_FOLDER::USER_CONFIG: - case SPECIAL_FOLDER::USER_DATA: + case SpecialFolder::userCache: + case SpecialFolder::userConfig: + case SpecialFolder::userData: { auto path = WIN32_GetKnownFolderPath(FOLDERID_Documents); if (path.empty()) { - path = GetFolderPath(SPECIAL_FOLDER::USER_HOME); + path = GetFolderPath(SpecialFolder::userHome); } return path; } - case SPECIAL_FOLDER::USER_HOME: + case SpecialFolder::userHome: { auto path = WIN32_GetKnownFolderPath(FOLDERID_Profile); if (path.empty()) @@ -119,7 +119,7 @@ namespace OpenRCT2::Platform } return path; } - case SPECIAL_FOLDER::RCT2_DISCORD: + case SpecialFolder::rct2Discord: { auto path = WIN32_GetKnownFolderPath(FOLDERID_LocalAppData); if (!path.empty()) diff --git a/src/openrct2/platform/Platform.h b/src/openrct2/platform/Platform.h index 470e2989ef..f06423796c 100644 --- a/src/openrct2/platform/Platform.h +++ b/src/openrct2/platform/Platform.h @@ -35,14 +35,14 @@ static_assert( std::endian::native == std::endian::little, "OpenRCT2 is known to be broken on big endian. Proceed with caution!"); -enum class SPECIAL_FOLDER +enum class SpecialFolder { - USER_CACHE, - USER_CONFIG, - USER_DATA, - USER_HOME, + userCache, + userConfig, + userData, + userHome, - RCT2_DISCORD, + rct2Discord, }; struct RealWorldDate; @@ -52,7 +52,7 @@ struct TTFFontDescriptor; namespace OpenRCT2::Platform { std::string GetEnvironmentVariable(std::string_view name); - std::string GetFolderPath(SPECIAL_FOLDER folder); + std::string GetFolderPath(SpecialFolder folder); std::string GetInstallPath(); std::string GetDocsPath(); std::string GetCurrentExecutablePath(); diff --git a/src/openrct2/platform/Platform.macOS.mm b/src/openrct2/platform/Platform.macOS.mm index ace348ec83..80a9edf710 100644 --- a/src/openrct2/platform/Platform.macOS.mm +++ b/src/openrct2/platform/Platform.macOS.mm @@ -30,19 +30,19 @@ namespace OpenRCT2::Platform { - std::string GetFolderPath(SPECIAL_FOLDER folder) + std::string GetFolderPath(SpecialFolder folder) { // macOS stores everything in ~/Library/Application Support/OpenRCT2 switch (folder) { - case SPECIAL_FOLDER::USER_CACHE: - case SPECIAL_FOLDER::USER_CONFIG: - case SPECIAL_FOLDER::USER_DATA: + case SpecialFolder::userCache: + case SpecialFolder::userConfig: + case SpecialFolder::userData: { - auto home = GetFolderPath(SPECIAL_FOLDER::USER_HOME); + auto home = GetFolderPath(SpecialFolder::userHome); return Path::Combine(home, "Library/Application Support"); } - case SPECIAL_FOLDER::USER_HOME: + case SpecialFolder::userHome: return GetHomePath(); default: return std::string();