From c002332f9ce6ddd066d0db8541a5bdbdf6bef048 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 13 Jan 2016 15:57:14 -0800 Subject: [PATCH] copy uninstaller to temp directory for correct naming --- cmake/templates/NSIS.template.in | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index a1c53c1f16..4a122615ce 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -932,6 +932,19 @@ FunctionEnd ; determine admin versus local install Function un.onInit + ; In order for the uninstaller to be able to remove itself, we have to do some trickery here. + ; If the $EXEPATH does not contain the $TEMP dir, this instance is not the copied one + ; so we move it to the $TEMP dir and then execute the copied uninstaller. + + ${StrContains} $0 $TEMP $EXEPATH + + ${If} $0 == "notfound" + CopyFiles /SILENT $EXEPATH $TEMP\Uninstall.exe + ExecWait '"$Temp\Uninstall.exe" _?=$INSTDIR' $0 + SetErrorLevel $0 + Quit + ${EndIf} + ; attempt to elevate the uninstaller to admin status uac_tryagain: !insertmacro UAC_RunElevated