4

i am new to inno setup. I want logging information, for that I set SetupLogging=yes and I used following code for getting log file .

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; 

but as and when i install installer , it is generating a new log file with filenames as Setup Log 2014-08-11 #001 ,Setup Log 2014-08-11 #002 and so on.

But i don't want multiple log files even if i run the installer multiple times.I want, Each time when i run it should overwrite existing log file itself. I mean there should be only one log file .How can i achieve it?

beginner
  • 191

1 Answers1

3

yes i got it. I just changed my script as follows :

[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
  logfilepathname, logfilename, newfilepathname: string;
  begin

  logfilepathname := expandconstant('{log}');

// logfilename := ExtractFileName(logfilepathname); 

// RenameFile(logfilename,'Setup_Log.log');

 newfilepathname := expandconstant('{app}\') +'Setup_Log.log'

 if CurStep = ssDone then
  begin
     filecopy(logfilepathname, newfilepathname, false);
  end;

  end;
beginner
  • 191