Files
CliFx/CliFx/Utils/EnvironmentEx.cs
2025-02-02 21:49:30 +02:00

21 lines
552 B
C#

using System;
using System.Diagnostics;
using System.Reflection;
namespace CliFx.Utils;
internal static class EnvironmentEx
{
private static readonly Lazy<string?> ProcessPathLazy = new(() =>
{
using var process = Process.GetCurrentProcess();
return process.MainModule?.FileName;
});
public static string? ProcessPath => ProcessPathLazy.Value;
private static readonly Lazy<Assembly?> EntryAssemblyLazy = new(Assembly.GetEntryAssembly);
public static Assembly? EntryAssembly => EntryAssemblyLazy.Value;
}