diff --git a/templates/nsis/allowOnlyOneInstallerInstace.nsh b/templates/nsis/allowOnlyOneInstallerInstace.nsh index 8fd9ff8769f..2be623ae5db 100644 --- a/templates/nsis/allowOnlyOneInstallerInstace.nsh +++ b/templates/nsis/allowOnlyOneInstallerInstace.nsh @@ -25,7 +25,7 @@ !macro CHECK_APP_RUNNING MODE ${nsProcess::FindProcess} "${APP_EXECUTABLE_FILENAME}" $R0 ${If} $R0 == 0 - MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "${PRODUCT_NAME} is running. $\r$\nClick OK to close it and continue with ${MODE}." /SD IDCANCEL IDOK doStopProcess + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "${PRODUCT_NAME} is running. $\r$\nClick OK to close it and continue with ${MODE}." /SD IDOK IDOK doStopProcess Quit doStopProcess: DetailPrint "Closing running ${PRODUCT_NAME} ..." diff --git a/templates/nsis/installer.nsi b/templates/nsis/installer.nsi index 73af96095e4..c4313b7fa25 100644 --- a/templates/nsis/installer.nsi +++ b/templates/nsis/installer.nsi @@ -48,25 +48,6 @@ Function .onInit !endif FunctionEnd -Function un.onInit - !insertmacro check64BitAndSetRegView - - ${IfNot} ${Silent} - MessageBox MB_OKCANCEL "Are you sure you want to uninstall ${PRODUCT_NAME}?" IDOK +2 - Quit - - !ifdef ONE_CLICK - SetSilent silent - !endif - ${EndIf} - - !insertmacro initMultiUser Un un. - - !ifmacrodef customUnInit - !insertmacro customUnInit - !endif -FunctionEnd - Section "install" ${IfNot} ${Silent} SetDetailsPrint none @@ -127,10 +108,34 @@ Section "install" ${EndIf} SectionEnd +Function un.onInit + !insertmacro check64BitAndSetRegView + + ${IfNot} ${Silent} + MessageBox MB_OKCANCEL "Are you sure you want to uninstall ${PRODUCT_NAME}?" IDOK +2 + Quit + + !ifdef ONE_CLICK + # one-click installer executes uninstall section in the silent mode, but we must show message dialog if silent mode was not explicitly set by user (using /S flag) + !insertmacro CHECK_APP_RUNNING "uninstall" + SetSilent silent + !endif + ${EndIf} + + !insertmacro initMultiUser Un un. + + !ifmacrodef customUnInit + !insertmacro customUnInit + !endif +FunctionEnd + Section "un.install" SetAutoClose true - !insertmacro CHECK_APP_RUNNING "uninstall" + !ifndef ONE_CLICK + # for boring installer we check it here to show progress + !insertmacro CHECK_APP_RUNNING "uninstall" + !endif StrCpy $startMenuLink "$SMPROGRAMS\${PRODUCT_FILENAME}.lnk" StrCpy $desktopLink "$DESKTOP\${PRODUCT_FILENAME}.lnk"