Archive: IfFileExists always fails?!


IfFileExists always fails?!
For some reason the IfFileExists function always evaluates to false.

IfFileExists $productFile continue
MessageBox MB_OK "Please select a valid product package file.
Abort
continue:
MessageBox MB_OK "Found file.


I have checked and doubled checked and the $productFile path is valid. Does anyone know what's up?

Thanks

Perhaps there are spaces in your file path?

Use:

IfFileExists "$productFile" continue


Otherwise... have you checked the actual value of that variable, or are you just checking that it is valid by assuming that the value you set it to, is what the value is at that point?

I would add a:
MessageBoxMB_OK"***91;$productFile***93;"

before the IfFileExists so you can see what the variable value -actually- is (including any leading/trailing spaces).

!include "MUI2.nsh" ( or LogicLib.nsh )


${ifnot} ${FileExists} "$productFile"
MessageBox MB_OK "Please select a valid product package file.
Abort
${else}
MessageBox MB_OK "Found file.
${endif}

or

${if} ${FileExists} "$productFile"
MessageBox MB_OK "Found file.
${else}
MessageBox MB_OK "Please select a valid product package file.
Abort
${endif}