How to log file copying process in Inno Setup

≯℡__Kan透↙ 提交于 2020-05-12 05:47:12

问题


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


回答1:


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);


来源:https://stackoverflow.com/questions/34634167/how-to-log-file-copying-process-in-inno-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!