]> git.lyx.org Git - features.git/blobdiff - development/Win32/packaging/installer2/src/main.nsh
Consider inset strings in simple find/replaceAll (#12049)
[features.git] / development / Win32 / packaging / installer2 / src / main.nsh
index 4bec8ac3067335935ed39d15c188816c0e91bf59..76263cbd28bc3c07563035ce23a6d21c984cb292 100644 (file)
@@ -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
@@ -380,7 +386,10 @@ Function RetrieveSMState # Custom function, called after the Startmenu page has
       StrCpy $StartMenuFolder ">$StartMenuFolder"
     ${Else}
       GetDlgItem $0 $mui.StartMenuPage 1005 # Get the HWND of the checkbox, MUI2 does not provide variable for that
-      SendMessage $0 ${BM_CLICK} 0 0 # NSIS delivers no other possibility here other than to send a click event to the checkbox
+      ${NSD_GetState} $0 $1
+      ${If} $1 = ${BST_UNCHECKED}
+        SendMessage $0 ${BM_CLICK} 0 0 # NSIS delivers no other possibility here other than to send a click event to the checkbox
+      ${EndIf}
     ${EndIf}
   ${EndIf}
 FunctionEnd
@@ -563,6 +572,7 @@ Section -ProgramFiles
   # Visual C++ redistributable (if native build)
   File "${FILES_DEPS}\bin\concrt140.dll"
   File "${FILES_DEPS}\bin\msvcp140.dll"
+  File "${FILES_DEPS}\bin\msvcp140_1.dll"
   File "${FILES_DEPS}\bin\vcamp140.dll"
   File "${FILES_DEPS}\bin\vccorlib140.dll"
   File "${FILES_DEPS}\bin\vcomp140.dll"
@@ -1011,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