2011-02-25 5 views

답변

16

SetupLogging 옵션 (SetupLogging=yes)을 설정하고 다음 코드를 스크립트에 통합하여 어딘가에 로그를 복사 할 수 있습니다. 라스에서 주석 다음

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; 
+6

실제로 모든 설정 단계에서 경로와 파일 이름을 다시 계산해야한다고 생각합니까? 왜 그것을 'If CurStep = ssDone then' 블록으로 옮기지 않겠습니까? –

+6

+1 Mittheil! 팁을 사용했지만 대신 DeinitializeSetup을 호출하십시오. 그런 다음 설치 프로그램이 설치되기 전에 사용자가 설치 프로그램을 종료하더라도 로그가 복사됩니다. – Lars

10

은 내가 DeinitializeSetup() 절차를 사용하지만, 나는 또한 설치 프로그램이 대신 {app} 일정에서 실행되는 디렉토리에 로그 파일을 복사 할 {src} 상수를 사용하여 새 파일 경로를 변경하는 사용자가 설치를 취소하면 생성 될 수 있습니다.

// Called just before Setup terminates. Note that this function is called even if the user exits Setup before anything is installed. 
procedure DeinitializeSetup(); 
var 
    logfilepathname, logfilename, newfilepathname: string; 
begin 
    logfilepathname := ExpandConstant('{log}'); 
    logfilename := ExtractFileName(logfilepathname); 
    // Set the new target path as the directory where the installer is being run from 
    newfilepathname := ExpandConstant('{src}\') + logfilename; 

    FileCopy(logfilepathname, newfilepathname, false); 
end; 
관련 문제