mhoydis
22nd January 2007 16:59 UTC
Allow for possibly non-existing recursive File instances
I am trying to make an NSIS script that will compile in 2 different file structures. I think the /nonfatal switch for File is what I want, however it does not seem to work recursively? Unless I'm making a stupid mistake?
Explanation...
I want to be able to use the File command, recursively, and nonfatally.
I want to be able to do something like...
File /r "../STUFF/*.*"
and have it just be ignored if the STUFF directory does not exists, OR if the STUFF directory is empty. If STUFF is present and does contain files I want them to be compressed and added to my archive.
File /r /nonfatal "../STUFF/*.*" does not seem to work!! It presents the "no files found" error at compilation.
What kind of logic can I write that would be able to test if a file/directory, relative to the compiler, is present? IfFileExists will not work for me because it is doing a compare of the end-user situation at runtime, and I require this kind of logic at the compiler. I'm familiar with {If} and all that logic, but how to I ask it about files relative to the compiler?
Any ideas?
Thanks
-Michael
Red Wine
22nd January 2007 17:16 UTC
File /r /nonfatal "../STUFF/*.*" does not seem to work!! It presents the "no files found" error at compilation.
If /nonfatal switch was designed to operate with /r (recursively) then this code would produce an empty (without files to install) installer.
Why not just open windows explorer and see if ../STUFF/ exists?
mhoydis
22nd January 2007 18:13 UTC
Originally posted by Red Wine
If /nonfatal switch was designed to operate with /r (recursively) then this code would produce an empty (without files to install) installer.
Yes, I agree. This does not seem to be the case.
Originally posted by Red Wine
Why not just open windows explorer and see if ../STUFF/ exists?
yeeeaaahhh see I know ../STUFF/ is empty. The act of determining if it exists or empty isn't for my own edification. I need the script to be flexible enough to determine this by itself.
(unless you mean there's a way to use "windows explorer" though scripting means to do this? If so, please elaborate.)
Red Wine
22nd January 2007 18:51 UTC
yeeeaaahhh see I know ../STUFF/ is empty. The act of determining if it exists or empty isn't for my own edification. I need the script to be flexible enough to determine this by itself.
I see... apologies my mistake
mhoydis
22nd January 2007 19:01 UTC
OK I've figured this out. Undocumented syntax alert....
File /r /nonfatal "../STUFF/*.*" does NOT work. "no files found" error during compile.
File /nonfatal /r "../STUFF/*.*" DOES work!! This allows for recursive inclusion of files or directories which may not exist.
Evidently the order of the switches is very important.
le sigh.
-Michael