1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 13:03:11 +01:00

Rename SPECIAL_FOLDER and its members

This commit is contained in:
Gymnasiast
2025-03-26 12:06:31 +01:00
parent c7d38b29fc
commit 5b7793f77b
7 changed files with 36 additions and 36 deletions

View File

@@ -227,9 +227,9 @@ std::unique_ptr<IPlatformEnvironment> 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

View File

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

View File

@@ -35,15 +35,15 @@ static std::shared_ptr<AndroidClassLoader> 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();

View File

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

View File

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

View File

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

View File

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