diff --git a/OpenRA.Game/Platform.cs b/OpenRA.Game/Platform.cs
index dcfe8afe83..3acd48fba1 100644
--- a/OpenRA.Game/Platform.cs
+++ b/OpenRA.Game/Platform.cs
@@ -79,6 +79,65 @@ namespace OpenRA
}
}
+ public static string OperatingSystem
+ {
+ get
+ {
+ if (CurrentPlatform == PlatformType.Linux)
+ {
+ var sessionType = Environment.GetEnvironmentVariable("XDG_SESSION_TYPE");
+ if (!string.IsNullOrEmpty(sessionType))
+ sessionType = $" ({sessionType})";
+ else
+ sessionType = "";
+
+ try
+ {
+ var psi = new ProcessStartInfo("hostnamectl", "status")
+ {
+ UseShellExecute = false,
+ RedirectStandardOutput = true
+ };
+
+ var p = Process.Start(psi);
+ string line;
+ while ((line = p.StandardOutput.ReadLine()) != null)
+ if (line.StartsWith("Operating System: "))
+ return line[18..] + sessionType;
+ }
+ catch { }
+
+ if (File.Exists("/etc/os-release"))
+ foreach (var line in File.ReadLines("/etc/os-release"))
+ if (line.StartsWith("PRETTY_NAME="))
+ return line[13..^1] + sessionType;
+ }
+ else if (CurrentPlatform == PlatformType.OSX)
+ {
+ try
+ {
+ var psi = new ProcessStartInfo("system_profiler", "SPSoftwareDataType")
+ {
+ UseShellExecute = false,
+ RedirectStandardOutput = true
+ };
+
+ var p = Process.Start(psi);
+ string line;
+ while ((line = p.StandardOutput.ReadLine()) != null)
+ {
+ line = line.Trim();
+ if (line.StartsWith("System Version: "))
+ return line[16..];
+ }
+ }
+ catch { }
+ }
+
+ return Environment.OSVersion.ToString();
+ }
+ }
+
///
/// Directory containing user-specific support files (settings, maps, replays, game data, etc).
///
diff --git a/OpenRA.Mods.Common/Widgets/Logic/SystemInfoPromptLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/SystemInfoPromptLogic.cs
index 81f8cb6a1b..107ce62892 100644
--- a/OpenRA.Mods.Common/Widgets/Logic/SystemInfoPromptLogic.cs
+++ b/OpenRA.Mods.Common/Widgets/Logic/SystemInfoPromptLogic.cs
@@ -20,17 +20,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public class SystemInfoPromptLogic : ChromeLogic
{
// Increment the version number when adding new stats
- const int SystemInformationVersion = 5;
+ const int SystemInformationVersion = 6;
static Dictionary GetSystemInformation()
{
- var lang = CultureInfo.InstalledUICulture.TwoLetterISOLanguageName;
- return new Dictionary()
+ return new Dictionary
{
{ "id", ("Anonymous ID", Game.Settings.Debug.UUID) },
{ "platform", ("OS Type", Platform.CurrentPlatform.ToString()) },
+ { "os", ("OS Version", Platform.OperatingSystem) },
{ "arch", ("Architecture", Platform.CurrentArchitecture.ToString()) },
- { "os", ("OS Version", Environment.OSVersion.ToString()) },
{ "x64", ("OS is 64 bit", Environment.Is64BitOperatingSystem.ToString()) },
{ "x64process", ("Process is 64 bit", Environment.Is64BitProcess.ToString()) },
{ "runtime", (".NET Runtime", Platform.RuntimeVersion) },
@@ -38,7 +37,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{ "windowsize", ("Window Size", $"{Game.Renderer.NativeResolution.Width}x{Game.Renderer.NativeResolution.Height}") },
{ "windowscale", ("Window Scale", Game.Renderer.NativeWindowScale.ToString("F2", CultureInfo.InvariantCulture)) },
{ "uiscale", ("UI Scale", Game.Settings.Graphics.UIScale.ToString("F2", CultureInfo.InvariantCulture)) },
- { "lang", ("System Language", lang) }
+ { "lang", ("System Language", CultureInfo.InstalledUICulture.TwoLetterISOLanguageName) }
};
}