Skip to content

Commit

Permalink
Update Steam path detection for Linux (#21948)
Browse files Browse the repository at this point in the history
* Update Steam path detection for Linux

As Steam now uses Proton to install Windows version natively, update
paths so they get found automatically

* Use new Steam path detection on Linux only

This restores Steam path detection on macOS as it doesn't have Proton
  • Loading branch information
janisozaur committed May 2, 2024
1 parent 9f69b53 commit 4e8f578
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
10 changes: 10 additions & 0 deletions src/openrct2/platform/Platform.Android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ namespace Platform
return {};
}

u8string GetRCT1SteamDir()
{
return {};
}

u8string GetRCT2SteamDir()
{
return {};
}

# ifndef NO_TTF
std::string GetFontPath(const TTFFontDescriptor& font)
{
Expand Down
21 changes: 19 additions & 2 deletions src/openrct2/platform/Platform.Linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,21 +299,38 @@ namespace Platform
return {};
}

auto steamPath = Path::Combine(homeDir, u8".local/share/Steam/ubuntu12_32/steamapps/content");
// Prefer new path for Steam, which is the default when using with Proton
auto steamPath = Path::Combine(homeDir, u8".local/share/Steam/steamapps/common");
if (Path::DirectoryExists(steamPath))
{
return steamPath;
}

steamPath = Path::Combine(homeDir, u8".steam/steam/ubuntu12_32/steamapps/content");
// Fallback paths
steamPath = Path::Combine(homeDir, u8".local/share/Steam/ubuntu12_32/steamapps/content");
if (Path::DirectoryExists(steamPath))
{
return steamPath;
}

steamPath = Path::Combine(homeDir, u8".steam/steam/ubuntu12_32/steamapps/content");
if (Path::DirectoryExists(steamPath))
{
return steamPath;
}
return {};
}

u8string GetRCT1SteamDir()
{
return u8"Rollercoaster Tycoon Deluxe";
}

u8string GetRCT2SteamDir()
{
return u8"Rollercoaster Tycoon 2";
}

# ifndef NO_TTF
std::string GetFontPath(const TTFFontDescriptor& font)
{
Expand Down
11 changes: 0 additions & 11 deletions src/openrct2/platform/Platform.Posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,17 +369,6 @@ namespace Platform
datetime64 utcNow = epochAsTicks + utcEpochTicks;
return utcNow;
}

u8string GetRCT1SteamDir()
{
return u8"app_285310" PATH_SEPARATOR u8"depot_285311";
}

u8string GetRCT2SteamDir()
{
return u8"app_285330" PATH_SEPARATOR u8"depot_285331";
}

} // namespace Platform

#endif
10 changes: 10 additions & 0 deletions src/openrct2/platform/Platform.macOS.mm
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,16 @@ MeasurementFormat GetLocaleMeasurementFormat()
return {};
}

u8string GetRCT1SteamDir()
{
return u8"app_285310" PATH_SEPARATOR u8"depot_285311";
}

u8string GetRCT2SteamDir()
{
return u8"app_285330" PATH_SEPARATOR u8"depot_285331";
}

std::string GetFontPath(const TTFFontDescriptor& font)
{
@autoreleasepool
Expand Down

0 comments on commit 4e8f578

Please sign in to comment.