From e4cac17f3db2a2020d4afffa79b9248e51f7228d Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Sat, 23 Oct 2021 00:07:39 +0300
Subject: [PATCH] SL-16121 Fix viewer not cleaning up obsolete plugin modules
 on install

---
 .../installers/windows/installer_template.nsi |  23 +++++++++++++++++-
 .../newview/installers/windows/lang_en-us.nsi | Bin 11434 -> 11802 bytes
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi
index 8838b6d0be1..668a8025bdf 100644
--- a/indra/newview/installers/windows/installer_template.nsi
+++ b/indra/newview/installers/windows/installer_template.nsi
@@ -605,6 +605,12 @@ FunctionEnd
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 Function RemoveProgFilesOnInst
 
+# We do not remove whole pervious install folder on install, since
+# there is a chance that viewer was installed into some important
+# folder by intent or accident
+# RMDir /r $INSTDIR is especially unsafe if user installed somewhere
+# like Program Files
+
 # Remove old SecondLife.exe to invalidate any old shortcuts to it that may be in non-standard locations. See MAINT-3575
 Delete "$INSTDIR\$INSTEXE"
 Delete "$INSTDIR\$VIEWER_EXE"
@@ -612,8 +618,23 @@ Delete "$INSTDIR\$VIEWER_EXE"
 # Remove old shader files first so fallbacks will work. See DEV-5663
 RMDir /r "$INSTDIR\app_settings\shaders"
 
-# Remove skins folder to clean up files removed during development
+# Remove folders to clean up files removed during development
+RMDir /r "$INSTDIR\app_settings"
 RMDir /r "$INSTDIR\skins"
+RMDir /r "$INSTDIR\vmp_icons"
+
+# Remove llplugin, plugins can crash or malfunction if they
+# find modules from different versions
+RMDir /r "$INSTDIR\llplugin"
+
+IfErrors 0 PREINSTALLCLEAN
+  StrCmp $SKIP_DIALOGS "true" PREINSTALLCLEAN
+    MessageBox MB_OKCANCEL $(CloseSecondLifeInstRM) IDOK PREINSTALLCLEAN IDCANCEL PREINSTALLFAIL
+
+PREINSTALLFAIL:
+    Quit
+
+PREINSTALLCLEAN:
 
 # We are no longer including release notes with the viewer, so remove them.
 Delete "$SMPROGRAMS\$INSTSHORTCUT\SL Release Notes.lnk"
diff --git a/indra/newview/installers/windows/lang_en-us.nsi b/indra/newview/installers/windows/lang_en-us.nsi
index ea680f08e4252ea5aed981ec13ed961eb9cfc621..f75ecfaf08f309a294d39d8a491922e5101fbd6c 100644
GIT binary patch
delta 132
zcmZ1#IV)xZm*QkINr}nx<W!i07<?xeir8|eF(fi%GUPC%GNeo{)DjOaX2@sA1@aUa
z(xBqSV0IB$Tmh(BfuVq*2&keAD4)+z$^eqjWXJ>3B|zC6Ak<?}VTb{WK*-?9@e0zL
JmnpFD001(F9Yg>C

delta 12
TcmbOgvnp}}m*VCsr3KsoBB2D&

-- 
GitLab