Skip to content

Commit

Permalink
fix(nsis): remove old < 6.4.1 versions
Browse files Browse the repository at this point in the history
Closes #735
  • Loading branch information
develar committed Sep 10, 2016
1 parent 7877f71 commit cb538c1
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 9 deletions.
30 changes: 30 additions & 0 deletions templates/nsis/installSection.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 12 additions & 8 deletions templates/nsis/multiUser.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/src/nsisTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
}
}, {
Expand Down

0 comments on commit cb538c1

Please sign in to comment.