Merge branch 'master' into dotnet5
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Imports System.Runtime.InteropServices
|
Imports System.IO
|
||||||
|
Imports System.Runtime.InteropServices
|
||||||
|
|
||||||
Namespace Runtime
|
Namespace Runtime
|
||||||
|
|
||||||
@@ -16,6 +17,8 @@ Namespace Runtime
|
|||||||
t = OSType.Linux
|
t = OSType.Linux
|
||||||
Case RuntimeInformation.IsOSPlatform(OSPlatform.OSX)
|
Case RuntimeInformation.IsOSPlatform(OSPlatform.OSX)
|
||||||
t = OSType.OSX
|
t = OSType.OSX
|
||||||
|
Case Else
|
||||||
|
t = OSType.Unknown
|
||||||
End Select
|
End Select
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -23,6 +26,35 @@ Namespace Runtime
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Public ReadOnly Property RealOSType As OSType
|
||||||
|
Get
|
||||||
|
Static t As OSType? = Nothing
|
||||||
|
|
||||||
|
If t Is Nothing Then
|
||||||
|
Dim windir As String = Environment.GetEnvironmentVariable("windir")
|
||||||
|
|
||||||
|
If Not String.IsNullOrEmpty(windir) AndAlso windir.Contains("\") AndAlso Directory.Exists(windir) Then
|
||||||
|
t = OSType.Windows
|
||||||
|
ElseIf File.Exists("/proc/sys/kernel/ostype") Then
|
||||||
|
Dim osTypeString As String = File.ReadAllText("/proc/sys/kernel/ostype")
|
||||||
|
If osTypeString.StartsWith("Linux", StringComparison.OrdinalIgnoreCase) Then
|
||||||
|
' Note: Android gets here too
|
||||||
|
t = OSType.Linux
|
||||||
|
Else
|
||||||
|
t = OSType.Unknown
|
||||||
|
End If
|
||||||
|
ElseIf File.Exists("/System/Library/CoreServices/SystemVersion.plist") Then
|
||||||
|
' Note: iOS gets here too
|
||||||
|
t = OSType.OSX
|
||||||
|
Else
|
||||||
|
t = OSType.Unknown
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return t
|
||||||
|
End Get
|
||||||
|
End Property
|
||||||
|
|
||||||
End Module
|
End Module
|
||||||
|
|
||||||
End Namespace
|
End Namespace
|
||||||
|
|||||||
Reference in New Issue
Block a user