1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 07:14:31 +01:00

Upgrade platform_get_steam_dir()

This commit is contained in:
Gymnasiast
2022-01-10 13:28:23 +01:00
parent eb2b0c1537
commit 310ad1e400
11 changed files with 98 additions and 102 deletions

View File

@@ -271,6 +271,45 @@ namespace Platform
}
return MeasurementFormat::Metric;
}
std::string GetSteamPath()
{
const char* steamRoot = getenv("STEAMROOT");
if (steamRoot != nullptr)
{
return Path::Combine(steamRoot, "ubuntu12_32/steamapps/content");
}
const char* localSharePath = getenv("XDG_DATA_HOME");
if (localSharePath != nullptr)
{
auto steamPath = Path::Combine(localSharePath, "Steam/ubuntu12_32/steamapps/content");
if (Path::DirectoryExists(steamPath))
{
return steamPath;
}
}
const char* homeDir = getpwuid(getuid())->pw_dir;
if (homeDir == nullptr)
{
return "";
}
auto steamPath = Path::Combine(homeDir, ".local/share/Steam/ubuntu12_32/steamapps/content");
if (Path::DirectoryExists(steamPath))
{
return steamPath;
}
steamPath = Path::Combine(homeDir, ".steam/steam/ubuntu12_32/steamapps/content");
if (Path::DirectoryExists(steamPath))
{
return steamPath;
}
return "";
}
} // namespace Platform
#endif