From 36c64ab02d4647bc55030771fb3fb466b3a8c9a1 Mon Sep 17 00:00:00 2001 From: Eugene Chornyi Date: Sat, 5 Dec 2020 11:38:58 +0100 Subject: [PATCH] Wininstaller2: copy user preferences from previous minor release --- .../Win32/packaging/installer2/src/main.nsh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/development/Win32/packaging/installer2/src/main.nsh b/development/Win32/packaging/installer2/src/main.nsh index 9bcd87a3f7..410910db0e 100644 --- a/development/Win32/packaging/installer2/src/main.nsh +++ b/development/Win32/packaging/installer2/src/main.nsh @@ -655,7 +655,7 @@ Section -TexRessources # Section installs cls files from Ressources\tex and upda ${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 @@ -956,6 +956,19 @@ Section -UninstallInfoRegistry # Registry information in "SOFTWARE\Microsoft\Win 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