logging - 如何在 Inno Setup 中记录文件复制过程

标签 logging installation inno-setup

在安装过程中,我需要将一些文件从一个文件夹复制到另一个文件夹,我如何确定这个复制过程是否成功?

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

是否有可能在安装过​​程中记录复制过程。

SetupLogging 不提供有关安装期间复制过程的任何信息

提前谢谢你

最佳答案

使用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;

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

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

关于logging - 如何在 Inno Setup 中记录文件复制过程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34634167/

相关文章:

sql - 无效查询的 MySQL 日志

c++ - 制作一个安装程序,在安装后安装工具栏

installation - 在运行时检查安装程序是否有 Uninstallable=True?

xml - Inno Setup - 如何在特定行中保存节点

inno-setup - 如果用户未选择任务,则将 key 写入注册表

go - 日志repo的抽象实现

使用 cron-job 将 Python 输出到文本文件

java - Log4j2 将记录到控制台,但不记录到 log.txt 文件

c# - 创建安装程序,错误文件夹路径 '.' 包含无效字符

inno-setup - TLabel 或 TNewStaticText - 在 Focus 上更改 .Font.Style,就像 Cursor 随 .Cursor 更改一样