\
Source Code
Commands
FileFind
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 an "AppSearch" table
entry, you may wish to modify the sequencing of this action.
This command takes these parameters:
- File (required)
This command allows searching for a file
or directory.
To search for a directory pass "" to this parameter otherwise
pass a filename without a path (for example "iexplore.exe").
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.
- 8.3 (optional)
This is the 8.3 (short name) of the file we are searching for.
If an "8.3" name is not supplied then if required one will be
generated however this may not always match the one you really need
to find (for example if you need to find "A_FILE~7.TXT" and not
"A_FILE~1.TXT").
- Property (required)
This is the name of the property to be updated if the file (or directory)
is found (it must not contain lower case characters).
This property is not created if the item doesn't exist!
- Default (optional)
Prior to searching for the file (or directory), the property is set to
this value and no validation need take place.
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).
- Message (optional)
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.
- Validate (optional)
If you don't supply a default value then normally validation will take place to ensure the search succeeded, pass "Y" in this parameter to prevent the validation.
- ValidateAfter (optional)
The validation (if performed) is inserted into the "InstallUISequence" and "InstallExecuteSequence" tables. By default the check will be inserted after the standard "AppSearch" action, this parameter can be used to specify another action name. 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.
- Parent (optional)
This is the "Parent" row of the
"DrLocator" table
and defaults to "".
- Path (optional)
This is the "Path" row of the
"DrLocator" table
and defaults to "".
It allows you to specify a root for the search
(for example "[ProgramFilesFolder]").
- Depth (optional)
This is the "Depth" row of the "DrLocator" table
and defaults to "6".
It indicates how many directory levels deep the search goes
from the root.
This speeds up the search but could mean that you miss what
you are after.
- MinVersion (optional)
This is the "MinVersion" row of the
"Signature" table
and defaults to "".
- MaxVersion (optional)
This is the "MaxVersion" row of the "Signature" table
and defaults to "".
- MinSize (optional)
This is the "MinSize" row of the "Signature" table
and defaults to "".
- MaxSize (optional)
This is the "MaxSize" row of the "Signature" table
and defaults to "".
- MinDate (optional)
This is the "MinDate" row of the "Signature" table
and defaults to "".
- MaxDate (optional)
This is the "MaxDate" row of the "Signature" table
and defaults to "".
- Languages (optional)
This is the "Languages" row of the "Signature" table
and defaults to "".
- Condition (optional)
Not normally required but if specified is an extra condition which has
to match for an error message to be displayed.
This could be useful if you only wanted to validate during install
etc.
- Signature (optional)
A search "signature" is something that gets displayed to the user, it is an MSI "Identifier" and so can't contain spaces and most special characters. 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).
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