如何在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);