Prev Previous Post   Next Post Next
Old 23rd March 2010, 14:13   #1
jweinraub
Senior Member
 
Join Date: Jan 2004
Posts: 197
Send a message via AIM to jweinraub
Uninstall previous version problems

We recently made a major version change to our software package, however we will still be offering the legacy version with the new version.

That being said, normally when the installer loads up, it looks if the previous version is installed and it uninstalls it.

Since the product name changed, the checker will now obviously only check if the new version is old, not both since it uses the $PRODUCT_NAME variable in the uninstall check function.

Would I need to simply add two functions or is there a way to check both variables at once?

code:

ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
"UninstallString"
StrCmp $R0 "" blah

; this perhaps should be handled better. maybe if they hit cancel the installer quits.
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"${PRODUCT_NAME} 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
no_remove_uninstaller:

blah:
FunctionEnd

jweinraub is offline   Reply With Quote
 
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump