1

Within an Inno Setup script, I run a VB executable program that installs a custom VB application (works OK no prob here).

But once this is done, after the VB setup is finished, I need to then copy some files to overwrite files and folders created by the VB setup executable. These 'updated' files have already been placed in their temp folder by the Inno Setup in the [Files] section and they are successfully deployed in that folder to the target PC.

The problem is that no matter what I have tried, it seems that for some reason the FileCopy commands are ignored.

So the steps I need are as follow:

// Copying the VB Setup executable that must run and Copying the files that will update the VB setup AFTER the VB setup has ran

[Files]
    Source: "C:\##Deploy\Titan\LABORATORY\BTLABSETUP.msi"   ; DestDir: "{app}\Temp"  ; Components: Laboratory ; Permissions: users-full
    Source: "C:\##Deploy\Titan\LABORATORY\BetolinkLAB\*.*"   ; DestDir: "{app}\Temp" ; Components: Laboratory ; Permissions: users-full ;  Flags: ignoreversion recursesubdirs 

I then run the VB Setup (which runs OK)

[Run]
    Filename: "msiexec.exe"; Parameters: "/i ""{app}\Temp\BTLABSETUP.msi" ; AfterInstall: CopyAllFiles

And immediately AFTER the VB executable, I need to copy and overwrite the files.

So what I need now is to copy back on the target computer, the files and folders that have been copied into the Temp folder, to replace the files in the same directory structure created by the VB executable.

So for example take all the files from the temp\Configuration folder and overwrite the same files existing in the {app}\Configuration folder.

This is why I used from a sample I found the afterinstall: which calls CopyAllFiles, and this is my code for CopyAllFiles

procedure CopyAllFiles;
begin

    MsgBox('About to Copy the files', mbInformation, MB_OK);

    FileCopy('{app}\Temp\*.*'                            , '{app}\*.*'                          , False)
    FileCopy('{app}\Temp\Configuration\*.*'              , '{app}\Configuration\*.*'            , False)
    FileCopy('{app}\Temp\Configuration\Korinthos\*.*'    , '{app}\Configuration\Korinthos\*.*'  , False)
    FileCopy('{app}\Temp\Configuration\Metamorfosi\*.*'  , '{app}\Configuration\Metamorfosi\*.*', False)
    FileCopy('{app}\Temp\Manual\*.*'                     , '{app}\Manual\*.*'                   , False)
    FileCopy('{app}\Temp\ScriptsUpload\*.*'              , '{app}\ScriptsUpload\*.*'            , False)
    FileCopy('{app}\Temp\Temp\*.*'                       , '{app}\Temp\*.*'                     , False)
    FileCopy('{app}\Temp\Templates\*.*'                  , '{app}\Templates\*.*'                , False)
    FileCopy('{app}\Temp\Temporary\*.*'                  , '{app}\Temporary\*.*'                , False)
end;

All the files and folders in the Temp source are there, I've checked them, nothing is missing. I have also tried without the wildcard for the target, did not work either, tried in CurStepChanged but nothing better.

From the messagebox that does pop up, I know that the code gets in the CopyAllFiles procedure after the VB executable, but nothing at all happens.

Any help or workaround would be more than welcome, need to prep this setup for a client and already very late and stuck...

Thank you
Yannis

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Yannis
  • 11
  • 1
  • `FileCopy` does not support Wildcards. This function copies Single file to new destination. In this case you would have to iterate files in folder with loop like here [Inno Setup - FileCopy use wildcard character in pathname](http://stackoverflow.com/questions/13688882/inno-setup-filecopy-use-wildcard-character-in-pathname). Or you could place it in `[Files]` section as `external` sources with additional `Check` or/and `BeforeInstall` function (where `BeforeInstall` could trigger installation of VB). – RobeN Jan 10 '17 at 12:08

1 Answers1

2

The FileCopy can copy a single file only.

To copy a whole directory tree, see
Inno Setup: copy folder, subfolders and files recursively in Code section.


Though in your case, wouldn't it be more appropriate (and easier to implement) to install the .msi programmatically, before the [Files] section gets processed? And then have the Files section install the files to the {app} directly?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992