简体   繁体   中英

Inno Setup - File Copy

I'm using Inno Setup with InnoTools Downloader and after the download completed I want to copy the downloaded file to the selected directory.

 if CurStep=ssPostInstall then begin
    FileCopy('Test.exe', ExpandConstant('{app}\Test.exe'), False);

It don't do anything, but if I restart the installer and I install again to the same folder, then it's copy the file. How is it possible or what I'm doing wrong? If I just do this, then it works properly each time:

 if CurStep=ssPostInstall then begin
    FileCopy('Test.exe', 'Test1.exe', False);

I solved with using the {src} constant:

// Add the file
itd_addfile('http://test.com/Test.exe',ExpandConstant('{src}\Test.exe'));

// Copy the file when it's finished the download
FileCopy(ExpandConstant('{src}\Test.exe'), ExpandConstant('{app}\Test.exe'), False);

// Delete the old file
DeleteFile(ExpandConstant('{src}\Test.exe'));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM