Archive: Check if ile exists in install dir and...


Check if ile exists in install dir and...
I have this in the first Installer Section (these are the first commands and the section can not be deselected):

IfFileExists "$INSTDIR\client.exe" 0 Skip
MessageBox MB_OK "This is not the correct directory!"
Abort
Skip;


It should detect if the file client.exe already is in the installdirectory. If it's not, it should abort - or even better: go back to the 'MUI_PAGE_DIRECTORY' page.

The code above doesn't work *at all* (i found something like this on these forums). I have no clue on how to do this....

Anyone? Thanks

You code is doing the exact opposite. First line should be:

IfFileExists "$INSTDIR\client.exe" Skip
edit:
To stop the user going past the directory page: move the code into a function called, say, LeaveDirectoryPage; then add the following line immediately before the MUI_PAGE_DIRECTORY line:
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE LeaveDirectoryPage
edit mk2:
Or you can do what Joost says below...

Skip;

should be

Skip:


To integrate the check in the directory page use the .onVerifyInstDir function (section 4.7.2.1.9 in the documentation).


Great! Got it working exactly as it should. Thanks!

PS. Putting a messagebox in the .onVerifyInstDir function can cause a lot of pop-ups.. ;)

The documentation is great! It's only hard to find stuff in there.. :(