This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit 85b38e6a70b912a2e1e5814a18c345e9412f6cb2
Author: Shad Storhaug <s...@shadstorhaug.com>
AuthorDate: Mon Dec 2 19:23:16 2019 +0700

    BUG: Updated platform detection on .NET Framework
---
 src/Lucene.Net/Util/Constants.cs | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/Lucene.Net/Util/Constants.cs b/src/Lucene.Net/Util/Constants.cs
index ee5ca28..2464c93 100644
--- a/src/Lucene.Net/Util/Constants.cs
+++ b/src/Lucene.Net/Util/Constants.cs
@@ -70,12 +70,10 @@ namespace Lucene.Net.Util
 #if NETSTANDARD
             return RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
 #else
-            // we use integers instead of enum tags because "MacOS"
-            // requires 2.0 SP2, 3.0 SP2 or 3.5 SP1.
             // 128 is mono's old platform tag for Unix.
             // Reference: https://stackoverflow.com/a/5117005
             int id = (int)Environment.OSVersion.Platform;
-            return id == 4 || id == 6 || id == 128;
+            return id == 4 || id == 128;
 #endif
         }
 
@@ -88,7 +86,6 @@ namespace Lucene.Net.Util
 #if NETSTANDARD
             return RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
 #else
-            // LUCENENET NOTE: On .NET Framework, our only possibilities are 
Windows or Linux
             PlatformID pid = Environment.OSVersion.Platform;
             return pid == PlatformID.Win32NT || pid == PlatformID.Win32Windows;
 #endif
@@ -114,7 +111,8 @@ namespace Lucene.Net.Util
 #if NETSTANDARD
             return RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
 #else
-            return false; // Not possible
+            // Reference: https://stackoverflow.com/a/5117005
+            return Environment.OSVersion.Platform == PlatformID.MacOSX;
 #endif
         }
 

Reply via email to