/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Tools/BuildValidator/IldasmUtilities.cs
51 строка
2 KB
Tomáš Matoušek
Remove test dependency from BuildValidator (#74669)
08 авг 2024, 00:52
Не верифицирован
08 авг 2024, 00:52
a36384c
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.IO; using System.Reflection; using System.Runtime.InteropServices; using Roslyn.Utilities; namespace BuildValidator { internal static class IldasmUtilities { private static string GetArchitecture() { #if NET8_0_OR_GREATER return RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); #else return "x64"; #endif } private static string GetIldasmPath() { var ildasmExeName = PlatformInformation.IsWindows ? "ildasm.exe" : "ildasm"; var directory = Path.GetDirectoryName(typeof(IldasmUtilities).GetTypeInfo().Assembly.Location) ?? throw new DirectoryNotFoundException(); string ridName; if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { ridName = "win-x64"; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { ridName = "osx-x64"; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { ridName = $"linux-{GetArchitecture()}"; } else { throw new PlatformNotSupportedException(); } return Path.Combine(directory, "runtimes", ridName, "native", ildasmExeName); } internal static readonly string IldasmPath = GetIldasmPath(); } }