Old 10th January 2008, 13:24   #1
Makedon
Junior Member
 
Join Date: Jan 2008
Posts: 6
uninstall or continue before install

code:
...some code...
InstallDir "$PROGRAMFILES\somewhere\"
...some code...
Section -Post
WriteUninstaller "$INSTDIR\uninstall.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"
SectionEnd

Function .onInit
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString"
StrCmp $R1 "" done

MessageBox MB_YESNO|MB_ICONEXCLAMATION \
"${PRODUCT_NAME} is already installed. $\n$\nDo you want to remove \
the old installation before installing ${PRODUCT_NAME} ." \
IDNO done

;Run the uninstaller
ClearErrors
ExecWait '$R1 _?=$INSTDIR'
done:
FunctionEnd




Im installing application in different folder than InstallDir

Why when i run the installer ,and when he find that application is already installed uninstaller run from InstallDir instead from the place where application is already installed - $R1

if i add
ExecWait '$INSTDIR\uninstall.exe'
uninstaller is not found.

I guess im missing something ,but what
Makedon is offline   Reply With Quote
Old 10th January 2008, 13:46   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
You're missing the fact that $INSTDIR is not yet initialized when running function .onInit

http://nsis.sourceforge.net/Docs/Chapter4.html#4.2.2

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 11th January 2008, 06:24   #3
Makedon
Junior Member
 
Join Date: Jan 2008
Posts: 6
Thanks for the tips ,it all working fine now ,this post help me too
Quote:
http://forums.winamp.com/showthread.php?postid=671288#post671288
Makedon is offline   Reply With Quote
Reply
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