Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to log file copying process in Inno Setup

During the installation, I need to copy some files from folder to another, how can I be sure, that this copying process was successful?

FileCopy(ExpandConstant('{src}\copy.txt'), ExpandConstant('{app}\test_success.txt'), false);

Is there any possibility to log copying process during installation.

SetupLogging does not provide any information about copying process during the installation

Thank You in advance

like image 376
Artur Tychina Avatar asked Dec 29 '25 18:12

Artur Tychina


1 Answers

Use Log function:

function FileCopyLogged(
  const ExistingFile, NewFile: String; const FailIfExists: Boolean): Boolean;
begin
  Result := FileCopy(ExistingFile, NewFile, FailIfExists);
  if Result then
  begin
    Log(Format('Copying %s to %s succeeded', [ExistingFile, NewFile]));
  end
    else
  begin
    Log(Format('Copying %s to %s failed', [ExistingFile, NewFile]));
  end;
end;

Use the FileCopyLogged the same way you are using FileCopy:

FileCopyLogged(
  ExpandConstant('{src}\copy.txt'), ExpandConstant('{app}\test_success.txt'), false);
like image 180
Martin Prikryl Avatar answered Dec 31 '25 19:12

Martin Prikryl



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!