Skip to content

Commit

Permalink
Improve Wine info (#35)
Browse files Browse the repository at this point in the history
* Improve Wine info

* Update WineInfo.cs
  • Loading branch information
MichalPetryka authored Jul 19, 2023
1 parent 7cb2117 commit 5df6f9f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions NorthwoodLib/WineInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,22 @@ static WineInfo()
WineVersion = "Wine Hidden";
}

UsesProton = kernelBase.IndexOf("Proton "u8) >= 0;
if (UsesProton)
WineVersion = $"Proton {WineVersion}";

try
{
string wineBuild = Marshal.PtrToStringAnsi((nint)GetWineBuildId());

if (!string.IsNullOrWhiteSpace(wineBuild))
WineVersion += $" {wineBuild}";
WineVersion = wineBuild;
}
catch (Exception ex)
{
PlatformSettings.Log($"Wine build not detected: {ex.Message}", LogType.Debug);
}

UsesProton = kernelBase.IndexOf("Proton "u8) >= 0;
if (UsesProton)
WineVersion = $"Proton {WineVersion}";

try
{
byte* sysnamePtr = null;
Expand All @@ -140,12 +140,11 @@ static WineInfo()
string release = Marshal.PtrToStringAnsi((nint)releasePtr)?.Trim() ?? "";
if (sysname != "" || release != "")
{
WineHost = "Host:";
if (!string.IsNullOrWhiteSpace(sysname))
WineHost += $" {sysname}";
WineHost = sysname;
if (!string.IsNullOrWhiteSpace(release))
WineHost += $" {release}";
WineVersion += $" Host:{WineHost}";
WineHost = WineHost.Trim();
WineVersion += $" Host: {WineHost}";
}
}
catch (Exception ex)
Expand Down

0 comments on commit 5df6f9f

Please sign in to comment.