diff --git a/templates/nsis/installSection.nsh b/templates/nsis/installSection.nsh index e7fbc4c128d..ccbfdfadd3e 100644 --- a/templates/nsis/installSection.nsh +++ b/templates/nsis/installSection.nsh @@ -24,6 +24,36 @@ ${endif} ${endif} !endif +### remove old < 6.4.1 versions + +ReadRegStr $R0 SHCTX "${UNINSTALL_REGISTRY_KEY}" UninstallString +${if} $R0 != "" + ReadRegStr $R2 SHCTX "${INSTALL_REGISTRY_KEY}" UninstallerPath + ${if} $R2 == "" + ReadRegStr $R1 SHCTX "${INSTALL_REGISTRY_KEY}" InstallLocation + ExecWait "$R0 _?=$R1 /S /KEEP_APP_DATA" + Delete "$R1\Uninstall *.exe" + ClearErrors + ${endif} +${endif} + +# remove per-user installation +${if} $installMode == "all" + ReadRegStr $R0 HKEY_CURRENT_USER "${UNINSTALL_REGISTRY_KEY}" UninstallString + ${if} $R0 != "" + ReadRegStr $R2 HKEY_CURRENT_USER "${INSTALL_REGISTRY_KEY}" UninstallerPath + ${if} $R2 == "" + ReadRegStr $R1 HKEY_CURRENT_USER "${INSTALL_REGISTRY_KEY}" InstallLocation + ExecWait "$R0 _?=$R1 /S /KEEP_APP_DATA" + Delete "$R1\Uninstall *.exe" + ClearErrors + ${endif} + ${endif} +${endif} + +### + + # http://stackoverflow.com/questions/24595887/waiting-for-nsis-uninstaller-to-finish-in-nsis-installer-either-fails-or-the-uni ReadRegStr $R0 SHCTX "${UNINSTALL_REGISTRY_KEY}" UninstallerPath diff --git a/templates/nsis/multiUser.nsh b/templates/nsis/multiUser.nsh index 7642ec9679a..27ff41efff7 100644 --- a/templates/nsis/multiUser.nsh +++ b/templates/nsis/multiUser.nsh @@ -32,11 +32,13 @@ Var installMode StrCpy $INSTDIR "$0\${PRODUCT_FILENAME}\${VERSION}" !endif - # сhecks registry for previous installation path (both for upgrading, reinstall, or uninstall) + # сhecks registry for previous installation path — for uninstall only, currently, installation path is not customizable ReadRegStr $perUserInstallationFolder HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation - ${if} $perUserInstallationFolder != "" - StrCpy $INSTDIR $perUserInstallationFolder - ${endif} + !ifdef BUILD_UNINSTALLER + ${if} $perUserInstallationFolder != "" + StrCpy $INSTDIR $perUserInstallationFolder + ${endif} + !endif !macroend !endif @@ -49,11 +51,13 @@ Var installMode StrCpy $INSTDIR "$PROGRAMFILES\${PRODUCT_FILENAME}\${VERSION}" - # checks registry for previous installation path (both for upgrading, reinstall, or uninstall) + # сhecks registry for previous installation path — for uninstall only, currently, installation path is not customizable ReadRegStr $perMachineInstallationFolder HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation - ${if} $perMachineInstallationFolder != "" - StrCpy $INSTDIR $perMachineInstallationFolder - ${endif} + !ifdef BUILD_UNINSTALLER + ${if} $perMachineInstallationFolder != "" + StrCpy $INSTDIR $perMachineInstallationFolder + ${endif} + !endif !macroend !endif diff --git a/test/src/nsisTest.ts b/test/src/nsisTest.ts index c7cc0c179c2..5303ae8e615 100644 --- a/test/src/nsisTest.ts +++ b/test/src/nsisTest.ts @@ -20,7 +20,7 @@ test("one-click", app({ devMetadata: { build: { // wine creates incorrect filenames and registry entries for unicode, so, we use ASCII - productName: "TestApp", + // productName: "TestApp", } } }, {