Archive: NSIS IfFileExists Thread Problem


NSIS IfFileExists Thread Problem
I have jumped from v1.36 to 1.94. I am having a problem with the new syntax for "IfFileExists". No matter what the results from IfFileExists all code below the if is executed even if code is broken into seperate subs. Anybody have any ideas

Example Below:

ReadINIStr $1 "$WINDIR\doors.ini" "DOORS" "Home" ; Temp Remove after working

IfFileExists $1\RMS_Data 0 Createdir
SetOutPath "$1\RMS_Data"

; Check for current language files
Rename "$1\RMS_Data\English.tms" "$1\RMS_Data\English.228"
Rename "$1\RMS_Data\Language.tms" "$1\RMS_Data\Language.228"
Rename "$1\RMS_Data\Swedish.tms" "$1\RMS_Data\Swedish.228"

; Install Language Files
File "C:\HTI Work\RMS\RMS Release 3.0\RMS_Data\English.tms"
File "C:\HTI Work\RMS\RMS Release 3.0\RMS_Data\Language.tms"
File "C:\HTI Work\RMS\RMS Release 3.0\RMS_Data\Swedish.tms"

Createdir:
CreateDirectory "$1\RMS_Data"
SetOutPath "$1\RMS_Data"
File "C:\HTI Work\RMS\RMS Release 3.0\RMS_Data\English.tms"
File "C:\HTI Work\RMS\RMS Release 3.0\RMS_Data\Language.tms"
File "C:\HTI Work\RMS\RMS Release 3.0\RMS_Data\Swedish.tms"


Simply remove the DIRECTORY\ from your path passed to IfFileExists and your script should work.
In 1.94 there's no difference between files (maybe with wildcards) and directories at IfFileExists.

~ Florian


NSIS IfFileExists Thread Problem
F. Heidenreich,

Thanks for the suggestion. I gave it a shot but all code is still executing.


You could at a second label End to your script to prevent this behaviour:

Name "Test"
OutFile "Test-Setup.exe"

Section
IfFileExists "$DESKTOP\Test" 0 Createdir
MessageBox MB_OK "Test exists"
Goto End
CreateDir:
MessageBox MB_OK "Test not exists"
End:
SectionEnd


~ Florian

That worked. Thanks for the help.