Move RCT2 Steam path retrieval to its own function

This commit is contained in:
Gymnasiast committed 2025-12-21 15:32:02 +01:00
1 parent 6db4ac56f2
commit b7608126a7
1 file changed
+30 -18
+30 -18
View File
@@ -745,25 +745,8 @@ namespace OpenRCT2::Config
return {};
}
/**
* Attempts to find the RCT2 installation directory.
* This should be created from some other resource when OpenRCT2 grows.
* @returns Path to RCT2, if found. Empty string otherwise.
*/
static u8string FindRCT2Path()
static u8string FindRCT2SteamPath()
{
LOG_VERBOSE("config_find_rct2_path(...)");
static std::vector<u8string_view> searchLocations = Platform::GetSearchablePathsRCT2();
for (const auto& location : searchLocations)
{
if (Platform::OriginalGameDataExists(location))
{
return u8string(location);
}
}
auto steamPaths = Platform::GetSteamPaths();
if (steamPaths.isSteamPresent())
{
@@ -792,6 +775,35 @@ namespace OpenRCT2::Config
}
}
return {};
}
/**
* Attempts to find the RCT2 installation directory.
* This should be created from some other resource when OpenRCT2 grows.
* @returns Path to RCT2, if found. Empty string otherwise.
*/
static u8string FindRCT2Path()
{
LOG_VERBOSE("config_find_rct2_path(...)");
static std::vector<u8string_view> searchLocations = Platform::GetSearchablePathsRCT2();
for (const auto& location : searchLocations)
{
if (Platform::OriginalGameDataExists(location))
{
return u8string(location);
}
}
// Will only return a path if the RCT2 data is present, so no need to check twice.
auto steamPath = FindRCT2SteamPath();
if (!steamPath.empty())
{
return steamPath;
}
auto discordPath = Platform::GetFolderPath(SpecialFolder::rct2Discord);
if (!discordPath.empty() && Platform::OriginalGameDataExists(discordPath))
{