Archive: basing an If on a file search


basing an If on a file search
I am trying to figure out how to do something which I know very well how to do in C++:

A collection of up to twenty exe's can be installed in one mother directory. Let's say they are all named 'Collie', followed by consecutive product numbers, e.g., Collie 1.exe, Collie 2.exe, etc.

In my uninstaller, I would like to base an If condition on whether or not at least one of these files exists, including verifying that the file found in each iteration is not the file asking to be uninstalled. If no other exe is found, then the condition is fulfilled and I will go ahead with comprehensive deletions.

Could I get some counsel on the best way to do this?

IfFileExists looks to me to be structured with Gotos, which I definitely do not prefer; furthermore I do not see how I can employ it as stated above.


IfFileExists looks to me to be structured with Gotos, which I definitely do not prefer
I'm not sure why you don't prefer, other than it can be a pain to code. But, it might be easier with LogicLib.

Here's an example that you might try:

!include logiclib.nsh
...
${If} ${FileExists} "Collie 1.exe"
${OrIf} ${FileExists} "Collie 2.exe"
${OrIf} ${FileExists} "Collie 3.exe"
; enter the code here for when one of the files exist
${Else}
; enter the code here for when none of the files exist
${EndIf}

Well, that's more mechanical and wordy than what I'm used to, but it seems I need lots of help with even a simple installer, and I have employed your suggestion successfully. Thank you very much!