From eb27408a3856e73d0725f8d2c5aeaaa49a4eaf1f Mon Sep 17 00:00:00 2001 From: Martin Prikryl Date: Sun, 20 Aug 2023 08:29:31 +0000 Subject: [PATCH] With application logging enabled, automatic updates installation is started with logging too Source commit: 495f301b4648efcdb080dfc608d4de8e8ec85c79 --- source/core/SessionInfo.cpp | 3 ++- source/core/SessionInfo.h | 2 ++ source/windows/Setup.cpp | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/source/core/SessionInfo.cpp b/source/core/SessionInfo.cpp index e987368d0..c9973a643 100644 --- a/source/core/SessionInfo.cpp +++ b/source/core/SessionInfo.cpp @@ -1793,7 +1793,8 @@ TApplicationLog::~TApplicationLog() void TApplicationLog::Enable(const UnicodeString & Path) { UnicodeString Dummy; - FFile = OpenFile(Path, Now(), NULL, false, Dummy); + FPath = Path; + FFile = OpenFile(FPath, Now(), NULL, false, Dummy); FLogging = true; } //--------------------------------------------------------------------------- diff --git a/source/core/SessionInfo.h b/source/core/SessionInfo.h index e79abf9a6..3ea283e65 100644 --- a/source/core/SessionInfo.h +++ b/source/core/SessionInfo.h @@ -370,8 +370,10 @@ class TApplicationLog void AddStartupInfo(); void __fastcall Log(const UnicodeString & S); __property bool Logging = { read = FLogging }; + __property UnicodeString Path = { read = FPath }; private: + UnicodeString FPath; void * FFile; bool FLogging; std::unique_ptr FCriticalSection; diff --git a/source/windows/Setup.cpp b/source/windows/Setup.cpp index 00dd4ac4d..bffb85eb7 100644 --- a/source/windows/Setup.cpp +++ b/source/windows/Setup.cpp @@ -1400,10 +1400,15 @@ void __fastcall TUpdateDownloadThread::UpdateDownloaded() { Params += L" /OpenGettingStarted"; } + if (ApplicationLog->Logging) + { + Params += FORMAT(" /LOG=\"%s\"", (ApplicationLog->Path + L".setup")); + } ExecuteShellChecked(SetupPath, Params); Configuration->Usage->Inc(L"UpdateRuns"); + AppLog(L"Terminating to allow installation..."); TerminateApplication(); } //---------------------------------------------------------------------------