nmartin
6th April 2010 18:13 UTC
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
Animaether
6th April 2010 18:44 UTC
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).
ahmett
6th April 2010 21:21 UTC
!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}