瀏覽代碼

With application logging enabled, automatic updates installation is started with logging too

Source commit: 495f301b4648efcdb080dfc608d4de8e8ec85c79
Martin Prikryl 2 年之前
父節點
當前提交
eb27408a38
共有 3 個文件被更改,包括 9 次插入1 次删除
  1. 2 1
      source/core/SessionInfo.cpp
  2. 2 0
      source/core/SessionInfo.h
  3. 5 0
      source/windows/Setup.cpp

+ 2 - 1
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;
 }
 //---------------------------------------------------------------------------

+ 2 - 0
source/core/SessionInfo.h

@@ -370,8 +370,10 @@ public:
   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<TCriticalSection> FCriticalSection;

+ 5 - 0
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();
 }
 //---------------------------------------------------------------------------