adesh singh
adesh singh

Reputation: 1727

install the updates of the setup on the actual setup location

I have installed a java application and i want to reinstall the new updates on the same location. but i am unable to read the location where the software is being installed .

I want if the full application is being installed in d:/program files then
   the new setup    should also be installed to the same location  

Upvotes: 1

Views: 172

Answers (1)

RobeN
RobeN

Reputation: 5456

Main application install script

[Setup]
AppId=MyMainApplicationId
AppName=MyApplicationName
AppVersion=MyApplicationVersion

Update install script

[Setup]
AppId=MyMainApplicationId
AppName=MyUpdateName
AppVersion=MyUpdateVersion

As both installscripts have the very same AppId, the update will use same dir as Main App. But... You should implement check that will look up if the Main Application is installed. You can try to place this [Code] in Update Install Script:

[Code]
function InitializeSetup: Boolean;
var
sUnInstallString: String;
begin
  if RegValueExists(HKEY_LOCAL_MACHINE,
'Software\Microsoft\Windows\CurrentVersion\Uninstall\MyMainApplicationId_is1',
'UninstallString') then 
    begin
      Result := True;
    end
    else begin
      MsgBox('Main Application was not found!', mbInformation, MB_OK);
      Result := False;
      Exit;
    end;
end;

Upvotes: 3

Related Questions