# 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'
+  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);
+end;

------------------------------------------------------------------------------
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