Use Environment.ProcessPath instead of GetCurrentProcess().MainModule.FileName

GetCurrentProcess().MainModule.FileName is expensive, Environment.ProcessPath added in net6
This commit is contained in:
Qstick 2023-01-09 22:14:22 -06:00
parent 7521579bca
commit f928ee7cad
3 changed files with 2 additions and 3 deletions

View File

@ -194,7 +194,6 @@ dotnet_diagnostic.CA1819.severity = suggestion
dotnet_diagnostic.CA1822.severity = suggestion
dotnet_diagnostic.CA1823.severity = suggestion
dotnet_diagnostic.CA1824.severity = suggestion
dotnet_diagnostic.CA1839.severity = suggestion
dotnet_diagnostic.CA1840.severity = suggestion
dotnet_diagnostic.CA1845.severity = suggestion
dotnet_diagnostic.CA1846.severity = suggestion

View File

@ -64,7 +64,7 @@ namespace NzbDrone.Common
var args = $"create {serviceName} " +
$"DisplayName= \"{serviceName}\" " +
$"binpath= \"{Process.GetCurrentProcess().MainModule.FileName}\" " +
$"binpath= \"{Environment.ProcessPath}\" " +
"start= auto " +
"depend= EventLog/Tcpip/http " +
"obj= \"NT AUTHORITY\\LocalService\"";

View File

@ -46,7 +46,7 @@ namespace NzbDrone.Host
try
{
Logger.Info("Starting Sonarr - {0} - Version {1}",
Process.GetCurrentProcess().MainModule.FileName,
Environment.ProcessPath,
Assembly.GetExecutingAssembly().GetName().Version);
var startupContext = new StartupContext(args);