如何在Inno Setup中记录文件复制过程 [英] How to log file copying process in Inno Setup

查看:465
本文介绍了如何在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不提供有关安装过程中复制过程的任何信息

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

提前谢谢

推荐答案

使用 功能:

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;

使用FileCopyLogged的方式与使用FileCopy的方式相同:

Use the FileCopyLogged the same way you are using FileCopy:

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

这篇关于如何在Inno Setup中记录文件复制过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆