Old 6th April 2010, 18:13   #1
nmartin
Junior Member
 
Join Date: Apr 2010
Posts: 2
IfFileExists always fails?!

For some reason the IfFileExists function always evaluates to false.

code:
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
nmartin is offline   Reply With Quote
Old 6th April 2010, 18:44   #2
Animaether
Major Dude
 
Join Date: Jun 2001
Posts: 1,173
Perhaps there are spaces in your file path?

Use:
code:
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:
PHP Code:
MessageBox MB_OK "[$productFile]" 
before the IfFileExists so you can see what the variable value -actually- is (including any leading/trailing spaces).
Animaether is offline   Reply With Quote
Old 6th April 2010, 21:21   #3
ahmett
Junior Member
 
Join Date: Jan 2008
Posts: 21
!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}
ahmett is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
iffileexists, nsis

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump