4
votes

I explain my project : my setup will be delivered with 2 licence files beside him who they must not be include inside the concerned setup. Like this :

Folder/
----Setup.exe
----CanBTL.dat
----CanBTP.dat

And i want, if that's sure they are here, to copy this files in a folder who will be build with Setup.exe. So i'm trying to make this code :

I edit my script : EDIT :

[Code]
function CheckForFile(CurPageID: Integer): Boolean;
begin
if (CurPageID = wpFinished) and (FileExists('CanBTL.dat' + 'CanBTP.dat')) then 
  begin
     FileCopy(ExpandConstant('CanBTL.dat' + 'CanBTP.dat'), ExpandConstant('{cf}\Folder\'), false); 
  end;
end;

The goal is to copy the two .dat file next to the setup in a folder created by the setup.exe

It compile, but seems to make nothing. My files are not copied.

I'm still a beginner to the section code in Inno Setup so if anyone can help me?

Thanks

1
For this purpose Inno Setup provides the external flag. By this flag you can manipulate with files not contained in the setup package. But they are processed at installation time, not at the end of the setup process (final page). E.g. by Source: "{sys}\calc.exe"; DestDir: "{app}"; Flags: external entry in the [Files] section I can copy calculator from the user's system to my application directory.TLama
What will happen in case the file doesn't exist? Namely I want to copy a file only if it exist. So will this create an error or just nothing will happen?Royi
I think this can help you stackoverflow.com/a/37164483/4303902Algorys

1 Answers

11
votes

Ok. No need of code section, that's working fine using external flags and the {src} constant to say current directory :

Source: "{src}\CanBTL.dat"; DestDir: "{cf}\Folder"; Flags: external;
Source: "{src}\CanBTP.dat"; DestDir: "{cf}\Folder"; Flags: external;

Thanks TLama