Use Environment.ProcessPath over calculating it ourselves

It's still required to be a static readonly field, as we need it calculated in-advance due to renames/deletion of original binary.

Also I'll probably need madness for this, sigh.
This commit is contained in:
Archi
2021-11-11 22:56:50 +01:00
parent f36e5618a4
commit 89a50674ec

View File

@@ -39,7 +39,7 @@ namespace ArchiSteamFarm.Core;
internal static class OS {
// We need to keep this one assigned and not calculated on-demand
internal static readonly string ProcessFileName = Process.GetCurrentProcess().MainModule?.FileName ?? throw new InvalidOperationException(nameof(ProcessFileName));
internal static readonly string ProcessFileName = Environment.ProcessPath ?? throw new InvalidOperationException(nameof(ProcessFileName));
internal static DateTime ProcessStartTime {
#if NETFRAMEWORK