From f2da193ef7b8c41d36c18c97fa416ff7d8396600 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 4 Jun 2014 17:10:33 -0700 Subject: [PATCH] More logging during output process --- src/NzbDrone.Update/UpdateApp.cs | 35 ++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/NzbDrone.Update/UpdateApp.cs b/src/NzbDrone.Update/UpdateApp.cs index 3691f6fce..1cc323e67 100644 --- a/src/NzbDrone.Update/UpdateApp.cs +++ b/src/NzbDrone.Update/UpdateApp.cs @@ -53,19 +53,7 @@ namespace NzbDrone.Update public void Start(string[] args) { var startupContext = ParseArgs(args); - string targetFolder; - - if (startupContext.ExecutingApplication.IsNullOrWhiteSpace()) - { - var exeFileInfo = new FileInfo(_processProvider.GetProcessById(startupContext.ProcessId).StartPath); - targetFolder = exeFileInfo.Directory.FullName; - } - - else - { - var exeFileInfo = new FileInfo(startupContext.ExecutingApplication); - targetFolder = exeFileInfo.Directory.FullName; - } + var targetFolder = GetInstallationDirectory(startupContext); logger.Info("Starting update process. Target Path:{0}", targetFolder); _installUpdateService.Start(targetFolder, startupContext.ProcessId); @@ -122,5 +110,26 @@ namespace NzbDrone.Update logger.Debug("NzbDrone process ID: {0}", id); return id; } + + private string GetInstallationDirectory(UpdateStartupContext startupContext) + { + if (startupContext.ExecutingApplication.IsNullOrWhiteSpace()) + { + logger.Debug("Using process ID to find installation directory: {0}", startupContext.ProcessId); + var exeFileInfo = new FileInfo(_processProvider.GetProcessById(startupContext.ProcessId).StartPath); + logger.Debug("Executable location: {0}", exeFileInfo.FullName); + + return exeFileInfo.DirectoryName; + } + + else + { + logger.Debug("Using executing application: {0}", startupContext.ExecutingApplication); + var exeFileInfo = new FileInfo(startupContext.ExecutingApplication); + logger.Debug("Executable location: {0}", exeFileInfo.FullName); + + return exeFileInfo.DirectoryName; + } + } } }