Configuring INNO: how to implement file updates based on different versions of the application

I have an application written in Delphi that has several versions containing binary files and a database (MDB) with directory data.

During the product life cycle, corrections / improvements are performed either in the database file or in some binary files.

The version is saved in the registry.

Users may have different versions of the program when a new patch is available.

Now users have different versions of how to implement the following script in Inno Setup:

  • If the user has version A, deny installation.
  • If the user has version B copy db over and file1, file2, file3.
  • If the user has version C, just update file1.

What is the correct way to implement this in setting up Inno?

+3
source share
3 answers

I'm not sure if this is the right way to do this, but you can use the [code] section and BeforeInstall flags

So

[Files]
Source: "MYPROG.EXE"; DestDir: "{app}"; BeforeInstall: MyBeforeInstall('{app}')
Source: "MYFILE.EXE"; DestDir: "{app}"; BeforeInstall: MyBeforeInstall('{app}')
Source: "MYDB.MDB"; DestDir: "{app}"; BeforeInstall: MyBeforeInstall('{app}')

[Code]

function MyBeforeInstall(InstallPath): Boolean;
begin
  Result:= FALSE;
    //Check if this file is ok to install
    MsgBox(CurrentFileName , mbInformation, MB_OK);
end;

Then use CurrentFileName to determine if the file can be installed, I'm not sure if it will just exit the installer if the result is false, or skip a separate file.

You can also use the [Types] / [Components] section to determine which files will be installed, but I don’t know if there is a way to automatically select this.

+2
source

Inno . , , , ; .

, , ( ), replacesameversion. Inno , . . .

+2

.

. - (http://agiletracksoftware.com/blog.html?id=4)

[Code]
; Each data file contains a single value and can be loaded after extracted.
; The filename and DestDir from the [Files] section must match the names
; and locations used here
function GetAppMajorVersion(param: String): String;
     var
          AppVersion: String;
     begin
          ExtractTemporaryFile('major.dat');
          LoadStringFromFile(ExpandConstant('{tmp}\major.dat'), AppVersion);
          Result := AppVersion;
     end;

function GetAppMinorVersion(param: String): String;
     var
          AppMinorVersion: String;
     begin
          ExtractTemporaryFile('minor.dat');
          LoadStringFromFile(ExpandConstant('{tmp}\minor.dat'), AppMinorVersion);
          Result := AppMinorVersion;
     end;

function GetAppCurrentVersion(param: String): String;
     var
          BuildVersion: String;
     begin
          ExtractTemporaryFile('build.dat');
          LoadStringFromFile(ExpandConstant('{tmp}\build.dat'), BuildVersion);
          Result := BuildVersion;
     end;

Outputting Code from the AgileTrack Blog: Using Inno Setup to Create an Installer with Version

0
source

All Articles