[MM-60416] Check for the presence of the EXE uninstaller before trying to run it (#3238)

Co-authored-by: Devin Binnie <devin@sourcestorm.net>
This commit is contained in:
Devin Binnie
2024-12-06 12:04:22 -05:00
committed by GitHub
parent b6325c9056
commit 48b5bb8a86

View File

@@ -1,5 +1,5 @@
diff --git a/node_modules/app-builder-lib/templates/msi/template.xml b/node_modules/app-builder-lib/templates/msi/template.xml
index 2d5cd3c..172339e 100644
index 2d5cd3c..3c2d128 100644
--- a/node_modules/app-builder-lib/templates/msi/template.xml
+++ b/node_modules/app-builder-lib/templates/msi/template.xml
@@ -1,5 +1,8 @@
@@ -23,7 +23,18 @@ index 2d5cd3c..172339e 100644
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage='A newer version of "[ProductName]" is already installed.'/>
<MediaTemplate CompressionLevel="${compressionLevel}" EmbedCab="yes"/>
@@ -26,6 +33,27 @@
@@ -20,12 +27,38 @@
<Property Id="ApplicationFolderName" Value="${installationDirectoryWixName}"/>
<Property Id="WixAppFolder" Value="WixPerUserFolder"/>
<Property Id="DISABLEADVTSHORTCUTS" Value="1"/>
+ <Property Id="EXEINSTALLEREXISTS">
+ <DirectorySearch Path="[LocalAppDataFolder]\Programs\mattermost-desktop" Depth="0">
+ <FileSearch Id="SearchEXEUninstaller" Name="Uninstall ${productName}.exe" />
+ </DirectorySearch>
+ </Property>
{{ if (iconPath) { }}
<Icon Id="${iconId}" SourceFile="${iconPath}"/>
<Property Id="ARPPRODUCTICON" Value="${iconId}"/>
{{ } -}}
@@ -45,13 +56,13 @@ index 2d5cd3c..172339e 100644
+ <InstallExecuteSequence>
+ <Custom Action="WixCloseApplications" Before="InstallValidate"/>
+ <Custom Action="WixCloseApplicationsDeferred" After="InstallInitialize"/>
+ <Custom Action="removeExeInstaller" After="InstallInitialize"/>
+ <Custom Action="removeExeInstaller" After="RemoveExistingProducts">EXEINSTALLEREXISTS</Custom>
+ </InstallExecuteSequence>
+
{{ if (isRunAfterFinish) { }}
<CustomAction Id="runAfterFinish" FileKey="mainExecutable" ExeCommand="" Execute="immediate" Impersonate="yes" Return="asyncNoWait"/>
{{ if (!isAssisted) { }}
@@ -42,6 +70,7 @@
@@ -42,6 +75,7 @@
<Property Id="ALLUSERS" Secure="yes" Value="2"/>
{{ } -}}
<Property Id="MSIINSTALLPERUSER" Secure="yes" Value="1"/>
@@ -59,7 +70,7 @@ index 2d5cd3c..172339e 100644
{{ if (isAssisted) { }}
<WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes"/>
@@ -80,6 +109,7 @@
@@ -80,6 +114,7 @@
</UI>
{{ } -}}
@@ -67,7 +78,7 @@ index 2d5cd3c..172339e 100644
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="${programFilesId}">
{{ if (menuCategory) { }}
@@ -110,6 +140,10 @@
@@ -110,6 +145,10 @@
{{-dirs}}
<ComponentGroup Id="ProductComponents" Directory="APPLICATIONFOLDER">