I have my installer doing the check for existing installation and doing uninstall first, essentially just as NSIS itself does (I stole the custom screen and functions right from makensis.nsi in the Examples folder).
I have discovered the following problem (bug?).
The code:
does what one expects / wants If and Only If the folder "Program Files" is included somewhere in the value of $INSTDIR, at the time the function is being executed. If $INSTDIR does NOT include "Program Files" in its value, the ExecWait Does Not Wait!.
HideWindow
ClearErrors
ExecWait '$R1 _?=$INSTDIR'
...
...
BringToFront
Note, it doesn't seem to matter what drive the installation was to, and $INSTDIR is the correct value of the "previous" installation, so the uninstall works correctly, it just doesn't wait, i.e the installer continues to run as if the ExecWait had been an Exec.
Is there something I can add to the code to force it to wait when the "previous" installation was NOT to a folder underneath a "Program Files" folder?