Skip to content

Commit

Permalink
Merge pull request RocketChat#233 from shrynx/windows-previous-install
Browse files Browse the repository at this point in the history
Update installer.nsi
  • Loading branch information
rodrigok authored Oct 11, 2016
2 parents 920d373 + c7cdc0b commit 5ef1020
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions resources/windows/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,41 @@ Var LaunchAppCheckbox_State
; --------------------------------

Function .onInit

; --------------------------------
; Checking previously installed version
; --------------------------------

ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${productName}" \
"UninstallString"
StrCmp $R0 "" done

MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${productName} is already installed. $\n$\nClick `OK` to remove the \
previous version or `Cancel` to cancel this upgrade." \
IDOK uninst
Abort
; --------------------------------
; Run the uninstaller
; --------------------------------
uninst:
ClearErrors
ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file

IfErrors no_remove_uninstaller done
;You can either use Delete /REBOOTOK in the uninstaller or add some code
;here to remove the uninstaller. Use a registry key to check
;whether the user has chosen to uninstall. If you are using an uninstaller
;components page, make sure all sections are uninstalled.
no_remove_uninstaller:

done:
; --------------------------------
; End of uninstaller
; --------------------------------


; Set installer to silent if /silent switch was provided
${GetParameters} $R0
${GetOptionsS} $R0 "/silent" $0
Expand Down

0 comments on commit 5ef1020

Please sign in to comment.