Archive: Automatic Uninstall if Uninstall has 2 possible names


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:

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

done:

FunctionEnd


Or

;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:


;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?

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}