dfc59eb20e
- Build in intrinsic commands as part of dotnet
38 lines
1 KiB
C#
38 lines
1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Runtime.InteropServices;
|
|
using System.IO;
|
|
|
|
using Microsoft.Dnx.Runtime.Common.CommandLine;
|
|
using Microsoft.DotNet.Cli.Utils;
|
|
using Microsoft.DotNet.Tools.Common;
|
|
|
|
namespace Microsoft.DotNet.Tools.Compiler.Native
|
|
{
|
|
static class RuntimeInformationExtensions
|
|
{
|
|
internal static OSMode GetCurrentOS()
|
|
{
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
{
|
|
return OSMode.Windows;
|
|
}
|
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
|
{
|
|
return OSMode.Mac;
|
|
}
|
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
{
|
|
return OSMode.Linux;
|
|
}
|
|
else
|
|
{
|
|
throw new Exception("Unrecognized OS. dotnet-compile-native is compatible with Windows, OSX, and Linux");
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|