From 189e3d52e2eb7c79e05ddff59f8a3c66a8709114 Mon Sep 17 00:00:00 2001 From: NextTurn <45985406+NextTurn@users.noreply.github.com> Date: Thu, 30 Jan 2020 00:00:00 +0800 Subject: [PATCH] Fix executable path on .NET Core --- src/Core/WinSWCore/Configuration/DefaultSettings.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Core/WinSWCore/Configuration/DefaultSettings.cs b/src/Core/WinSWCore/Configuration/DefaultSettings.cs index d28c46c..b9d2566 100644 --- a/src/Core/WinSWCore/Configuration/DefaultSettings.cs +++ b/src/Core/WinSWCore/Configuration/DefaultSettings.cs @@ -19,9 +19,7 @@ namespace winsw.Configuration public string Executable => throw new InvalidOperationException(nameof(Executable) + " must be specified."); public bool HideWindow => false; - // this returns the executable name as given by the calling process, so - // it needs to be absolutized. - public string ExecutablePath => Path.GetFullPath(Environment.GetCommandLineArgs()[0]); + public string ExecutablePath => Process.GetCurrentProcess().MainModule.FileName; // Installation public bool AllowServiceAcountLogonRight => false;