[LyX/master] Wininstaller2: silently uninstall old LyX if not the same minor version

Eugene Chornyi yu_jin at lyx.org
Fri Dec 11 20:44:49 UTC 2020


commit bd8a9d3ce339ac81c3f064398bcf3060828ba146
Author: Eugene Chornyi <yu_jin at lyx.org>
Date:   Fri Dec 11 22:15:02 2020 +0100

    Wininstaller2: silently uninstall old LyX if not the same minor version
---
 .../Win32/packaging/installer2/src/main.nsh        |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/development/Win32/packaging/installer2/src/main.nsh b/development/Win32/packaging/installer2/src/main.nsh
index 410910d..4bec8ac 100644
--- a/development/Win32/packaging/installer2/src/main.nsh
+++ b/development/Win32/packaging/installer2/src/main.nsh
@@ -522,6 +522,17 @@ Section -CheckSilent # This section checks if it's a silent install and calls ne
   Call DefaultDesktopFileAssoc
 SectionEnd
 
+Section -UninstallOld
+  ${If} ${FileExists} "$INSTDIR\Uninstall-LyX.exe"
+    ${GetFileVersion} "$INSTDIR\Uninstall-LyX.exe" $0
+    StrCpy $0 $0 3 # get only the first 3 chars, e.g. "2.3"
+    ${If} $0 != "${VERSION_MAJOR}.${VERSION_MINOR}"
+      ExecWait "$INSTDIR\Uninstall-LyX.exe /S _?=$INSTDIR" # silently uninstall old LyX
+      Delete "$INSTDIR\Uninstall-LyX.exe"
+    ${EndIf}
+  ${EndIf}
+SectionEnd
+
 Section -OverInstallReg # If over-installing, we need to delete the registry keys written by the previous installment
   Call PrepareShellCTX # Helper function from above
   StrCpy $1 0


More information about the lyx-cvs mailing list