Checking application prerequisites


Revision as of 22:25, 1 December 2008 by Uecasm (Talk | contribs)
Jump to: navigation, search

Checking for external prerequisites

Where your application requires some other component (not included in the setup) to already be installed before installation can proceed, you can do the checking in the InitializeSetup event function:

function IsMyPrerequisiteInstalled(): Boolean;
  Result := {whatever code you need to check whether it's installed or not};

function InitializeSetup(): Boolean;
  Result := True;
  if not IsMyPrerequisiteInstalled() then begin
    MsgBox('MyPrerequisite is not installed.  Installation cannot continue.', mbError, MB_OK);
    Result := False;

Checking for your own application

For partial upgrades or addons (where the main body of your application is not included in the setup), you can use the same pattern as above to check for existence of your own application. Usually the simplest way to do that is to look for its Uninstall entry (as shown in Upgrades; for extra paranoia you could also read out the installation folder and check whether the actual .exe file is there (and what version it is).

Note: when building addon installers, you need to carefully consider what you want the uninstall behaviour to be, which will influence how you choose the AppId for the addon.

Personal tools