commit a2e4ce1803a814d934cda69c045c9e4bb80a4426
Author: Eugene Chornyi <[email protected]>
Date:   Sat Dec 12 10:04:17 2020 +0100

    Wininstaller2: improved check if over installing
---
 .../Win32/packaging/installer2/src/main.nsh        |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/development/Win32/packaging/installer2/src/main.nsh 
b/development/Win32/packaging/installer2/src/main.nsh
index 905b80b..76263cb 100644
--- a/development/Win32/packaging/installer2/src/main.nsh
+++ b/development/Win32/packaging/installer2/src/main.nsh
@@ -371,6 +371,12 @@ FunctionEnd
 Function RetrieveSMState # Custom function, called after the Startmenu page 
has been created
   ${IfNot} ${FileExists} "$INSTDIR\Uninstall-LyX.exe"
     Return # Not over-installing
+  ${Else}
+    ${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}"
+      Return # Installing over a wrong version
+    ${EndIf}
   ${EndIf}
 
   Call PrepareShellCTX # Helper function from above
@@ -1015,6 +1021,12 @@ Function DefaultDesktopFileAssoc # Custom function, 
called before the components
 
   ${IfNot} ${FileExists} "$INSTDIR\Uninstall-LyX.exe"
     Return # Not over-installing
+  ${Else}
+    ${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}"
+      Return # Installing over a wrong version
+    ${EndIf}
   ${EndIf}
 
   Call PrepareShellCTX
-- 
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to