MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / FindRCT2Path

Function FindRCT2Path

src/openrct2/config/Config.cpp:805–838  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

803 * @returns Path to RCT2, if found. Empty string otherwise.
804 */
805 static u8string FindRCT2Path()
806 {
807 LOG_VERBOSE("config_find_rct2_path(...)");
808
809 static std::vector<u8string> searchLocations = Platform::GetSearchablePathsRCT2();
810
811 for (const auto& location : searchLocations)
812 {
813 if (Platform::OriginalGameDataExists(location))
814 {
815 return location;
816 }
817 }
818
819 // Will only return a path if the RCT2 data is present, so no need to check twice.
820 auto steamPath = FindRCT2SteamPath();
821 if (!steamPath.empty())
822 {
823 return steamPath;
824 }
825
826 auto discordPath = Platform::GetFolderPath(SpecialFolder::rct2Discord);
827 if (!discordPath.empty() && Platform::OriginalGameDataExists(discordPath))
828 {
829 return discordPath;
830 }
831
832 auto exePath = Path::GetDirectory(Platform::GetCurrentExecutablePath());
833 if (Platform::OriginalGameDataExists(exePath))
834 {
835 return exePath;
836 }
837 return {};
838 }
839
840 static u8string SelectGogInstaller()
841 {

Callers 1

Calls 7

OriginalGameDataExistsFunction · 0.85
FindRCT2SteamPathFunction · 0.85
GetDirectoryFunction · 0.85
GetSearchablePathsRCT2Function · 0.50
GetFolderPathFunction · 0.50
GetCurrentExecutablePathFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected