2016-01-06 43 views
1

在安裝過程中,我需要將一些文件從文件夾複製到另一個文件夾,我怎麼能確定這個複製過程是否成功?如何在Inno Setup中記錄文件複製過程

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

安裝過程中是否有可能記錄複製過程。

SetupLogging不提供有關在安裝過程中複製過程中的任何信息

預先感謝您

+0

你的意思是什麼「複製過程」?你是否複製現有文件? (=未安裝)如何複製文件?使用'[Files]'部分或使用Pascal代碼?給我們看一看! –

+0

@Martin我在pascal代碼中執行此操作: FileCopy(ExpandConstant('{src} \ copy.txt'),ExpandConstant('{app} \ test_success.txt'),false); –

回答

1

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

使用您正在使用FileCopyFileCopyLogged以同樣的方式:

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

非常感謝你! –