Skip to content

Commit

Permalink
Merge pull request #2249 from Nexus-Mods/bg3-version-fix
Browse files Browse the repository at this point in the history
Fix BG3 incorrect version on MyGames page
  • Loading branch information
Al12rs authored Nov 14, 2024
2 parents 0b8adb9 + 19f700f commit af6c9ba
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Games/NexusMods.Games.Larian/BaldursGate3/BaldursGate3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ public BaldursGate3(IServiceProvider provider) : base(provider)
_serviceProvider = provider;
_osInformation = provider.GetRequiredService<IOSInformation>();
}

protected override Version GetVersion(GameLocatorResult locatorResult)
{
try
{
// Use the vulkan executable to get the version, not the primary file (launcher)
var executableGamePath = _osInformation.IsOSX
? new GamePath(LocationId.Game, "Contents/MacOS/Baldur's Gate 3")
: new GamePath(LocationId.Game, "bin/bg3.exe");

var fvi = executableGamePath
.Combine(locatorResult.Path).FileInfo
.GetFileVersionInfo();
return fvi.ProductVersion;
}
catch (Exception)
{
return new Version(0, 0, 0, 0);
}
}

public override GamePath GetPrimaryFile(GameStore store)
{
Expand Down

0 comments on commit af6c9ba

Please sign in to comment.