Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 27th May 2009, 06:19   #1
phungus420
Junior Member
 
Join Date: Apr 2009
Posts: 15
Automatic Uninstall if Uninstall has 2 possible names

Simple question, hoping for a simple solution

Here goes, durring my mod's inception there have been mulitple install scripts I've used, hasn't been an issue until recently. Where through my lack of forsight there are now two possible names for the uninstaller.exe the installer will create.

Now when the mod updates to a new version, it must clean out all the old files and so runs the uninstaller:

code:
;Run the uninstaller
uninst:
ClearErrors
ExecWait '"$INSTDIR\Mods\${MOD_LOC}\Uninstall.exe" _?=$INSTDIR'

done:

FunctionEnd



Or

code:
;Run the uninstaller
uninst:
ClearErrors
ExecWait '"$INSTDIR\Mods\${MOD_LOC}\${MOD_NAME} Uninstall.exe" _?=$INSTDIR'

done:

FunctionEnd



My question is, is there anyway to check for which uninstall exe exists (there are only two possible names), and run whichever one it finds. In pseudocode something like this:

code:

;Run the uninstaller
!ifExists
$INSTDIR\Mods\${MOD_LOC}\Uninstall.exe
uninst:
ClearErrors
ExecWait '"$INSTDIR\Mods\${MOD_LOC}\Uninstall.exe" _?=$INSTDIR'
!else
uninst:
ClearErrors
ExecWait '"$INSTDIR\Mods\${MOD_LOC}\${MOD_NAME} Uninstall.exe" _?=$INSTDIR'

done:

FunctionEnd



Is such pseudocode possible, and if so how do I write it?
phungus420 is offline   Reply With Quote
Old 27th May 2009, 10:17   #2
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
standard NSIS
IfFileExists <file path> goto_if_true goto_if_false

or using LogicLib:
${If} ${FileExists} <file path 1>
; run path 1
${ElseIf} ${FileEists} <file path 2>
; run path 2
${EndIf}
Animaether is offline   Reply With Quote
Reply
Go Back   Winamp 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