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
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
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
# 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"
${If} ${FileExists} "$0\broadway.cls"
Return
${EndIf}
- CopyFiles "$INSTDIR\Resources\tex\*.*" $0
+ CopyFiles /SILENT "$INSTDIR\Resources\tex\*.*" $0
ExecWait '$LatexPath\texhash' # Update package file list
${Else} # Miktex
WriteRegDWORD SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\LyX${APP_VERSION_DOTLESS}" "EstimatedSize" $0
SectionEnd
+!if ${VERSION_MINOR} > 0 # Only valid for minor releases of the same major release (e.g. not valid for 3.0)
+ Section -CopyOldPreferences # Searches user's preferences (userdir) from previous minor release and copies it if necessary
+ Call PrepareShellCTX
+ SetShellVarContext current # Otherwise $APPDATA would return C:\ProgrammData instead of C:\Users\username\AppData\Roaming
+
+ IntOp $0 ${VERSION_MINOR} - 1 # only check the direct previous minor release
+ ${If} ${FileExists} "$APPDATA\LyX${VERSION_MAJOR}.$0\lyxrc.defaults"
+ ${AndIfNot} ${FileExists} "$APPDATA\LyX${VERSION_MAJOR}.${VERSION_MINOR}\lyxrc.defaults"
+ CopyFiles /SILENT "$APPDATA\LyX${VERSION_MAJOR}.$0\*.*" "$APPDATA\LyX${VERSION_MAJOR}.${VERSION_MINOR}"
+ ${EndIf}
+ SectionEnd
+!endif
+
Section -ConfigureScript # Runs the configure.py script
# Manipulate PATH environment of the running installer process, so that configure.py can find all the stuff needed
${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