mirror of
https://github.com/actions/runner.git
synced 2025-12-10 20:36:49 +00:00
63 lines
1.9 KiB
C#
63 lines
1.9 KiB
C#
using System;
|
|
|
|
namespace GitHub.Runner.Common.Util
|
|
{
|
|
public static class VarUtil
|
|
{
|
|
public static StringComparer EnvironmentVariableKeyComparer
|
|
{
|
|
get
|
|
{
|
|
switch (Constants.Runner.Platform)
|
|
{
|
|
case Constants.OSPlatform.Linux:
|
|
case Constants.OSPlatform.OSX:
|
|
return StringComparer.Ordinal;
|
|
case Constants.OSPlatform.Windows:
|
|
return StringComparer.OrdinalIgnoreCase;
|
|
default:
|
|
throw new NotSupportedException(); // Should never reach here.
|
|
}
|
|
}
|
|
}
|
|
|
|
public static string OS
|
|
{
|
|
get
|
|
{
|
|
switch (Constants.Runner.Platform)
|
|
{
|
|
case Constants.OSPlatform.Linux:
|
|
return "Linux";
|
|
case Constants.OSPlatform.OSX:
|
|
return "macOS";
|
|
case Constants.OSPlatform.Windows:
|
|
return "Windows";
|
|
default:
|
|
throw new NotSupportedException(); // Should never reach here.
|
|
}
|
|
}
|
|
}
|
|
|
|
public static string OSArchitecture
|
|
{
|
|
get
|
|
{
|
|
switch (Constants.Runner.PlatformArchitecture)
|
|
{
|
|
case Constants.Architecture.X86:
|
|
return "X86";
|
|
case Constants.Architecture.X64:
|
|
return "X64";
|
|
case Constants.Architecture.Arm:
|
|
return "ARM";
|
|
case Constants.Architecture.Arm64:
|
|
return "ARM64";
|
|
default:
|
|
throw new NotSupportedException(); // Should never reach here.
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|