2009/1/17 TK Soh <[email protected]>

> On Sat, Jan 17, 2009 at 11:02 AM,  <[email protected]> wrote:
> > # HG changeset patch
> > # User Peer Sommerlund <[email protected]>
> > # Date 1232176016 -3600
> > # Node ID e6985e65ed68b5b1d5f418c234a342829663a25c
> > # Parent  fd6602d77a1915fa77b63b2def815d9f58c8307c
> > installer: Uninstall old version before installing new version
> >
> > diff -r fd6602d77a19 -r e6985e65ed68 installer/tortoisehg.iss
> > --- a/installer/tortoisehg.iss  Sat Jan 17 03:52:31 2009 +0000
> > +++ b/installer/tortoisehg.iss  Sat Jan 17 08:06:56 2009 +0100
> > @@ -59,3 +59,29 @@
> >  Filename: "{app}\add_path.exe"; Parameters: "/del {app}"
> >  Filename: "regsvr32.exe"; Parameters: "/s /u ""{app}\tortoisehg.dll"""
> >
> > +[Code]
> > +{ Uninstall old TortoiseHg before proceeding with installation }
> > +function InitializeSetup(): Boolean;
> > +const
> > +  UninstallKey = 'Software\Microsoft\Windows\CurrentVersion\Uninstall\';
> > +  AppKey = 'TortoiseHg_is1'
>
> How reliable is this app key? I'd rather no rely on an undocumented info.


UninstallKey - see http://msdn.microsoft.com/en-us/library/ms954376.aspx

AppKey - quote from Inno Setup 5 help file, index "AppId"

AppId also determines the actual name of the Uninstall registry key, to
which Inno Setup tacks on "_is1" at the end. (Therefore, if AppId is
"MyProgram", the key will be named "MyProgram_is1".) Pre-1.3 versions of
Inno Setup based the key name on the value of AppVerName.

One could argue that

AppUninstallKey = UninstallKey + AppId + '_is1'

would be more clean.

>
>
> > +  AppUninstallKey = UninstallKey + AppKey;
> > +var
> > +  Uninstaller: String;
> > +  ResultCode: Integer;
> > +begin
> > +  Result := True; { Continue installation }
> > +  if not RegQueryStringValue(
> > +    HKLM, AppUninstallKey, 'UninstallString', Uninstaller)
> > +  then Exit;
> > +
> > +  Result := False; { Abort installation }
> > +  if MsgBox('Old version must be uninstalled before installation.' #13
> > +    'Do you want me to uninstall it now?', mbConfirmation, MB_YESNO)
> > +    = idNo
> > +  then Exit;
> > +
> > +  Exec(RemoveQuotes(Uninstaller), ' /SILENT', '',
> > +    SW_SHOWNORMAL, ewNoWait, ResultCode);
> > +  MsgBox('Please reboot and run installer again', mbInformation, MB_OK);
>
> Does that mean user will get two reboot requests, one from the
> uninstaller and other from this one?


Yes. My idea was to hint the user that he had to rerun the installer
manually after reboot.

On my machine the "please reboot" msg box shows up before the "please
reboot" message from the uninstaller. I don't know why.

If you dislike two reboot dialogs, then perhaps the message that the user
will have to rerun the installer could be added to the initial dialog. Maybe
with this text: 'Old version must be uninstalled first, then you must run
the installer again' #13 'Do you want to run uninstaller now?'


> > +end;
>

PS. I don't think I will be able to send a new patch before 0.6 if you plan
to build it today. Feel free to hack away on it yourself.

Regards,
Peer
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to