ArDarsh
ArDarsh

Reputation: 41

Overwrite installed files with files in setup subfolder in Inno Setup

I recently have found some old PC games to play on my Windows 10 64-bit computer. I have looked at various online sources to get the games working. Now I'm interested in creating a custom installer for all the various steps taken to get the games to work properly. I succeeded getting C&C Generals to work with a custom installer via Inno Setup. I however lack the expertise after a bit of research and trial to do the following:

  1. I am able to install the software and use the official patch to update the installed software.
  2. I am unsure how to add a script to copy modified files from the install subfolder to overwrite the installed files in the main folder after the update. The update does not work on the modified files.

Example:

Does this go under the [Code] section? Can it go under the [Run] section with a postinstall flag? Like a simple copy and overwrite command as the last step?

Thanks!

Upvotes: 4

Views: 582

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202088

There many ways to achieve this.

  1. You can execute the patch using the AfterInstall parameter, even before the "mod" is installed. See Inno Setup: Install other installer and run it before continuing my install. Then you can install the mod straight to the installation folder (not to the subfolder):

    [Files]
    ; Install original game
    Source: C:\source\TheGame\*; Dest: {app}
    ; Run patch
    Source: C:\patch\PatchTheGame.exe; Dest: {tmp}; AfterInstall: RunPatch
    ; Install mod
    Source: C:\mod\Program.exe; Dest: {app}
    
  2. Use Run entry to copy the mod after you install the patch:

    [Files]
    ; Install original game
    Source: C:\source\TheGame\*; Dest: {app}
    ; Extract the patch somewhere
    Source: C:\patch\PatchTheGame.exe; Dest: {tmp}
    ; Extract the mod somewhere
    Source: C:\mod\Program.exe; Dest: {tmp}
    
    [Run]
    Filename: {tmp}\PatchTheGame.exe
    Filename: {cmd}; Parameters: /C copy ""{tmp}\Program.exe"" ""{app}\Program.exe""
    
  3. You can code it in Pascal Script. See Install customized version of configuration file in Inno Setup after (Firebird) subinstaller finishes

Upvotes: 1

Related Questions