Archive: confused by IfFileExists


confused by IfFileExists
Hi all.
I'm having a strange behaviour using IfFfilextist instruction. May be I'm using a wrong syntax, but anyway here is the code :

IfFileExists P:\spedizi\postallverG\*.MDD 0 +2
File p:\spedizi\postallverG\*.MDD

SetOutPath "$INSTDIR\..\Post"

The logic would be to check if some file with .mdd extension does exists in a specific directory located on a network disk. If at least one file exists, it should add all of them to the installation file. If not, it should skip the File statement and proceed with the SetOutputPath command.

Strangely, in any case, the program flow execute the File statement that fails making the compilation process to abort.

In the documentation the IiFfileExist command is documented this way :

file_to_check_for jump_if_present [jump_otherwise]

and the sample code of the statement is
IfFileExists $WINDIR\notepad.exe 0 +2
MessageBox MB_OK "notepad is installed"

I'm almost sure that I'm missing something but I can't guess what. May that the wildcards are not allowed ? Or the problem is in the remote path of the file to be checked ?

Thanks for your opinions.

Sandro


...
The command explains itself. The name is IfFileExist and not IfExtensionExistInThisFolder. :D
You can only specify ONE FILE then it looks for THIS FILE. The command can´t search for fileextensions in specified folder...

You have to code it your own. But it shouldn´t be so tricky. ;)


Not to mention IfFileExists is a run-time instruction. You can't use to to check if a file exists on the build machine.

Stu


Originally posted by Highcoder
You can only specify ONE FILE then it looks for THIS FILE. The command can´t search for fileextensions in specified folder...
IfFileExists accepts wildcards without any problems.

As Afrow said, IfFileExists is a runtime command, not compiletime. There are compiletime commands like !system that allow you to do some funky stuff like conditional file compilation. Or you can use a bat file to make a file list and !include that in your script. Or maybe execute a vbscript during compilation (forum search for this).

You can of course use wildcards with IfFileExists. As for File, you can use /nonfatal if you don't care whether the file should be included or not.

Please mind the language MSG.

Stu


My bad, won't happen again. Thanks for the correction.


...
Oh, really? Sorry. Learning never stops.
And never mind MSG. What i wrote was really utter b..... :)
I totally overlooked that he used it for compiletime...

Cheers


Many thanks for your opinions guys. I'm just a NSIS beginner and I need to further explore the language and the environment.

Sandro