The "FileFind" Command |
This command is used to find a file or directory (perhaps to validate its existance).
Unfortunately the Windows Installer "AppSearch" logic is not smart enough to be able to search the "PATH" environment variable.
The found item's name is placed into a property specified by you.
As the search is done via the "AppSearch" table entry, you may wish to modify the sequencing of this action.
If you don't need to search a tree (depth > 1) or you can list possible directories then you may find the similar "FileFindInListedDirs" command useful.
$$TODO FIX DOCO
This command takes these parameters (plus most parameters from "FileFind" to do with specifying the file's characteristics):
If not specified then the existance of the property will be validated (the install will fail if it does not exist).
This value can be "" to indicate that no validation should take place (the property is not set to null).
It indicates how many directory levels deep the search goes from the root (0=no subdirectories). This speeds up the search but could mean that you miss what you are after.
If you have not used the "Default" parameter and the MSI needs to display an error message it will use a default message unless you specify what it should say with this parameter. Note that the message can contain MSI formatting or "CRLF".
The "Validate" parameter controls whether or not we will fail (displaying this message) if the file isn't found.
If the filename is not a valid "8.3" name then you may want to consider using the "8.3" parameter otherwise MAKEMSI will determine the "likely" (not potentially "known") name.
This parameter also supports the "8.3|long" windows installer format.
The need for this parameter is probably rare but you would need to specify "ResolveSource" if you wish to look for files relative to the "SourceDir" (MSI) directory. See the "COMPANY_INSERT_ResolveSourceAction" macro or take some other action to install this action if required.
The default signature is the property name so if you make this meaningful then you probably don't need to use this parameter (except in the case where you might be populating the same property from two or more sources).
EXAMPLES |
Look for "PPWIZARD.REX" to a maximum directory depth of 4:
<$FileFind File="PPWIZARD.REX" Property="PPWIZARD.REX" Depth=4> <$FileFind File="IEXPLORE.EXE" Property="IEXPLORE.EXE" Path="[ProgramFilesFolder]"> #( <$FileFind File="JAR.EXE" Property="JAR.EXE" Path="[ProgramFilesFolder]" Message=^Could not install this product as "JAR.EXE" could not be located in the "[ProgramFilesFolder]" directory tree!^ > #)
EXAMPLE - Does Directory Exist? |
In the following, if the directory doesn't exist then a message will be displayed (implements a "launch condition"):
<$FileFind File="" Property="SOMEDIR" Path="c:\SomeDir\SomeSubDir">
For an example of finding a file that may be located in more than one place have a look at the "Finding 'WSCRIPT.EXE' or 'CSCRIPT.EXE' Files" tip