From 89a50674ec67df9cec478c30331c67b9a8f92626 Mon Sep 17 00:00:00 2001 From: Archi Date: Thu, 11 Nov 2021 22:56:50 +0100 Subject: [PATCH] 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. --- ArchiSteamFarm/Core/OS.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArchiSteamFarm/Core/OS.cs b/ArchiSteamFarm/Core/OS.cs index def0d836b..980492fd1 100644 --- a/ArchiSteamFarm/Core/OS.cs +++ b/ArchiSteamFarm/Core/OS.cs @@ -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