Skip to content

Commit

Permalink
Store platform id after first detection so we aren't querying it more…
Browse files Browse the repository at this point in the history
… than we need to.
  • Loading branch information
jcsnider committed Sep 28, 2020
1 parent 04ed6e5 commit e71ca75
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions Intersect.Client/MonoGame/Input/MonoClipboard.cs
Expand Up @@ -8,6 +8,8 @@ namespace Intersect.Client.MonoGame.Input
public class MonoClipboard : GameClipboard
{

private PlatformID? mPlatform = null;

/// <inheritdoc />
public override bool CanCopyPaste()
{
Expand Down Expand Up @@ -97,18 +99,23 @@ public override void SetText(string data)
/// Get the platform we are currently running on.
/// </summary>
/// <returns>Returns the <see cref="PlatformID"/> of the platform we are running on.</returns>
private static PlatformID GetPlatform()
private PlatformID GetPlatform()
{
var platform = Environment.OSVersion.Platform;
// If Unix, are we on Mac or Linux?
if (platform == PlatformID.Unix)
if (mPlatform == null)
{
if (GetShellOutput(UnixPlatforms.MacOSX, "uname").Contains("Darwin"))
var platform = Environment.OSVersion.Platform;
// If Unix, are we on Mac or Linux?
if (platform == PlatformID.Unix)
{
platform = PlatformID.MacOSX;
if (GetShellOutput(UnixPlatforms.MacOSX, "uname").Contains("Darwin"))
{
platform = PlatformID.MacOSX;
}
}
mPlatform = platform;
}
return platform;

return (PlatformID)mPlatform;
}

#region Linux/Mac Support
Expand Down

0 comments on commit e71ca75

Please sign in to comment.