1
votes

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);
1
Specify the full path to the first parameter (ExistingFile) as well. Give it the full path where you downloaded your file. Otherwise you are expecting your source file to be placed in the current directory (path returned e.g. by the GetCurrentDir function).TLama
Thanks for your fast answer, but can you tell me please how can I download the file directly to the selected directory? I'm adding the file to the downloader at this part: InitializeWizard, but I can't use the {app} here, because it's not yet initialized. Where is the code part after the path has been selected?YolmieK

1 Answers

1
votes

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'));