How can I log Inno Setup installations?

后端 未结 2 509
囚心锁ツ
囚心锁ツ 2020-12-23 17:34

Inno Setup has command line parameter /LOG=\"filename\". Can I specify a log filename from inside the Inno Setup script, so I can include it later in my error r

2条回答
  •  隐瞒了意图╮
    2020-12-23 18:23

    You can set the SetupLogging option (SetupLogging=yes) then integrate the following code into your script to copy the log somewhere.

    procedure CurStepChanged(CurStep: TSetupStep);
    var
      logfilepathname, logfilename, newfilepathname: string;
    begin
      logfilepathname := ExpandConstant('{log}');
      logfilename := ExtractFileName(logfilepathname);
      newfilepathname := ExpandConstant('{app}\') + logfilename;
    
      if CurStep = ssDone then
      begin
        FileCopy(logfilepathname, newfilepathname, false);
      end;
    end; 
    

提交回复
热议问题