The "Files" Command |
This command adds all files that match the file mask(s) you supply. This command can include all or parts of a whole directory tree and can also be supplied a list of files or filemasks to process.
The "File" command adds a single file at a time (and allows "renaming"). Also have a look at the "Create Macro For Adding Files" tip for an example of one way of simplifying file addition.
If you are adding a large number of files and this is a bit slow then you should have a look at the performance section!
If MAKEMSI has problems and ignores (or doesn't find) files whose names or directories contain "international" characters then please see the documentation for the "MAKEMSI_MM_CODEPAGE" environment variable.
With the default MSI schema it can have a maximum of 32,767 files, however MAKEMSI will take a while to create this MSI and Windows Installer will be very slow to install and uninstall it. If you have large numbers of files I recommend you read the "performance" and "TABLES_FILE_SEQ_NUMBER_LIMIT" sections of this manual!
I recommend that you read the "Resource Life Cycle" section.
The command takes these parameters:
There are currently two modes of operation:
You must not try to add the files to specific Windows Installer component (use "Component=^^" if required) as a component can only contain files for a single directory.
Subdirectories without matching files are not duplicated and folder attributes are not maintained. If you require empty subdirectories to be created you can either define these yourself (for an example see the "DirectoryTree" command) or use an approach like that demonstrated by "TryMeLoadDirTreeMaintainingAttributes.MM" (which also copies directory attributes).
If this parameter is not supplied and if this command is nested between "component" and "/component" commands then the name of the "current" component is used (otherwise "" is used). The component's attributes control installation and uninstallation conditions and behaviour.
When creating components MAKEMSI will create as few components as possible (one per directory) except if the file extension is configured in the macro "FILE_EXTENSIONS_WHICH_NEED_OWN_COMPONENT", or this macro contains "*" (for all). To create components we must know which feature they belong to and if required you can pass Component parameters in the "OPTIONS4COMPONENT" parameter.
This is one way of ensuring that an unversioned (or even versioned) file(s) you have included in the packages gets installed (its not left up to windows installer's versioning rules).
Note that "N" simply means don't use the "RemoveFile" command, it does not mean that the file will not be removed on uninstalled etc (see the "Resource Life Cycle" section if thats what you are interested in).
The default for this parameter can be set via the DEFAULT_FILES_REMOVE macro. The initial value is "N".
The default for this parameter can be set via the DEFAULT_FILE_ATTRIBUTES macro. The initial value for this is "Vital".
Available attributes (use space as a separator):
You should also remember that "component" attributes such as "NeverOverWrite" and "Permanent" are frequently useful.
If this parameter is supplied then the value overrides the default value which is based on the current nesting of the Cabinet and /Cabinet commands.
An error message will result if an unknown value is supplied.
The value of this parameter should be "" or one or more of the above attributes. It does not make much sense to have specified the same bits in the "Attributes" parameter as duplicated bits will always get set.
The default for this parameter can be set via the DEFAULT_FILE_ATTRIBUTES_TO_COPY macro. The initial value for this is "" (don't copy attributes).
This parameter can be used to exclude files during the processsing of the current command (if it already exists and is non-empty) or to record the processed files in the specified exclude list so that they won't be processed again in a subsequent "Files" command.
You can use the "FilesExclude" command to define some initial exclusions if you need to.
The default for this parameter can be set via the DEFAULT_FILE_SELFREGISTER macro. The initial value for this is "N".
The following shows the self registration related defaults:
#define? DEFAULT_FILE_SELFREGISTER N ;;N=Never, Y=Unordered, ?=Unordered Self register if binary supports it, else ordered self registration #define? FILE_AUTOMATIC_SELF_REGISTRATION_RECORD_NO Y ;;We are interested in when self registration was not done (html report) #define? FILE_AUTOMATIC_SELF_REGISTRATION_DETECT_ERROR_ACTION S ;;D=Die, S=Say & Ignore, I=Ignore (if not 'D' we assume testing will show up issues...) #define? FILE_AUTOMATIC_SELF_REGISTRATION_RECORD_NO_OK_VBEXP "<span title='We successfully determined that this file does not have self registration entry points!'>No</span>" #define? FILE_AUTOMATIC_SELF_REGISTRATION_RECORD_NO_ERR_VBEXP "<span title=""" & {$ErrDescVar} & """>No<font color=red>?</font></span>" #define? FILE_SUPPORT_WINDOWS_HARDLINKS_BUG Y ;;Windows file hardlink support flawed. #( ';' ;--- Semi colon (";") delimitered list of file extensions ---------------- #define? FILE_EXTENSIONS_WHICH_MAY_SELF_REGISTER .dll .ocx #)
The default for this parameter can be set via the DEFAULT_FILE_ROWKEY_CASE macro. The initial value for this is "" (don't adjust the case).
Note that Windows Installer does not support file hashes for versioned files, for this reason MAKEMSI will ignore this parameter for these files.
The default for this parameter can be set via the DEFAULT_FILE_WANT_FILEHASH macro. The initial value for this is "Y" (want a hash).
The default for this parameter can be set via the DEFAULT_FILES_NO_MATCHES_OK macro. The initial value is "N".
If a non-blank value is supplied then it must be a date in the format "YYYY-MM-DD" (or "?" to use the current build date). It is a Microsoft restriction that "YYYY" be greater than or equal to "1980".
The default for this parameter can be set via the DEFAULT_FILE_DATE macro. The initial value is "".
If a non-blank value is supplied then it must be a time in the format "HH:MM:SS" (or "?" to use the current build date). Note that the seconds ("SS") value must be an even number.
The default for this parameter can be set via the DEFAULT_FILE_TIME macro. The initial value is "".
The default for this parameter can be set via the DEFAULT_FILE_OPTIONS4COMPONENT macro. The initial value for this is "".
If this includes component keypath information such as "CU='Y'" then you must also set the "FILE_GENERATED_COMPONENT_USE_FILE_AS_KEYPATH" option to "N" or the keypath information will be overwritten (a file keypath will be the result).
The default for this parameter can be set via the DEFAULT_FILE_DOCO macro. The initial value for this is "Y".
Main File Related Options |
Please see the "options for commands" section of the manual.
#define? DEFAULT_FILE_WANT_FILEHASH T ;;Generate MD5 (Y=YES, N=NO, T=TRY). MD5 needs Windows Installer 2.0+ #define? DEFAULT_FILE_ATTRIBUTES Vital ;;Only use if user did not supply #define? DEFAULT_FILE_ATTRIBUTES_TO_COPY ;;Choose one or more from hidden/system/readonly #define? DEFAULT_FILE_LANG_WHEN_GETLANGUAGE_FAILS 1033 ;;Can be "" #define? DEFAULT_FILE_ACCESS #define? DEFAULT_FILE_REMOVE N ;;Don't remove files by default! #define? DEFAULT_FILE_DATE ;;""= file date or date in "YYYY-MM-DD" (exactly 10 characters) #define? DEFAULT_FILE_TIME ;;""= file time or time in "HH:mm:SS" (exactly 8 characters and seconds even) #define? DEFAULT_FILE_DOCO Y ;;"N" = Don't add to doco (by default) #define? DEFAULT_FILE_OPTIONS4COMPONENT ;;Any options for autocreated components #define? DEFAULT_FILE_OPTION_MAKE_REMOVE_DIRECTORIES Y ;;Now make/remove directories by default #define? FILE_HTMLRPT_INSTALLTIME_COMMENT_TEXT * ;;What the user sees #define? FILE_HTMLRPT_INSTALLTIME_COMMENT_HTML <span title='The install time of the file will be "{?}"'><font color=red><$FILE_HTMLRPT_INSTALLTIME_COMMENT_TEXT></font></span> ;;Don't use Double quotes and ONLY the text in the "FILE_HTMLRPT_INSTALLTIME_COMMENT_TEXT" macro should be visible to user (or sorting won't work correctly)!!! #define? FILE_GENERATED_COMPONENT_PREFIX c ;;Begins any components generated by the "file(s)" commands, followed by unique number ("" means don't add unique prefix) #define? FILE_GENERATED_COMPONENT_USE_FILE_AS_KEYPATH Y ;;Must be "Y" unless you have set a keypath in the "Options4Component" parameter (in which case should be "N")! #define? FILE_GENERATED_COMPONENT_MAX_LENGTH <$TABLES_LNG_COMPONENT_COLUMN> ;;Should be shorter than or equal to value in "TABLES_LNG_COMPONENT_COLUMN" (see doco for error code 2716) #( ';' ;--- Semi colon (";") delimitered list of file extensions ---------------- #define? FILE_EXTENSIONS_WHICH_NEED_OWN_COMPONENT ;;"*" means all .exe .dll .ocx .hlp .chm #) #define? FILE_COMMAND_ALLOWED ;;If not blank then not allowed and is the error message. You can use "{NL}" to represent newlines #define? FILE_VERSION_FOR_UNVERSIONED_FILES #define? DEFAULT_FILE_ROWKEY_CASE ;;Can be "" or "L" or "U" #define? DEFAULT_FILE_ROWKEY_MAXLNG <$TABLES_LNG_FILE_COLUMN>-4 ;;0 = no restriction (this limit is WITHOUT any possible number added to make unique!) #define? FILE_HTMLRPT_HR <$SUNDRY_HTMLRPT_HR> #define? FILE_HTMLRPT_ROWKEY MAKEMSI_Documentation ;;Name of special case which does not exist when code generated! #define? FILE_HTMLRPT_MAX_EXTENSION_WIDTH 7 #define? FILE_STYLE_TEXT_ERROR color:red #define? FILE_STYLE_TEXT_OK color:green #define? FILE_VERIFY_STYLE_FILENAME_DEFAULT_LOCN color:blue #define? FILE_VERIFY_OUTPUT_BACKGROUND_COLOR #dfdfdf #define? FILE_VERIFY_SHOW_COMPONENT_OK_MESSAGE_WHEN_FILES_ALSO_OK N #define? FILE_VERIFY_ATTRIBUTE_SET.H <b>H</b> #define? FILE_VERIFY_ATTRIBUTE_SET.R <b>R</b> #define? FILE_VERIFY_ATTRIBUTE_SET.S <b>S</b> #define? FILE_VERIFY_ATTRIBUTE_RESET.H h #define? FILE_VERIFY_ATTRIBUTE_RESET.R r #define? FILE_VERIFY_ATTRIBUTE_RESET.S s #( '<?NewLine>' #define? FILE_STYLES .FileCmtPlus {font-size:9pt;} .FileCmtName {<$HTMLRPT_STYLE_VALUES_KEY>} .FileCmtValue {<$HTMLRPT_STYLE_VALUES_VALUE>} .FileCmtSFI {color:maroon} <$FILE_STYLES_VERIFY> <$FILE_STYLES_VERIFY_COMPONENT_CHECKS> #) #( '<?NewLine>' #define? FILE_STYLES_VERIFY .FileVerify_DoesNotExist {<$FILE_STYLE_TEXT_ERROR>} .FileVerify_FileNameDefault {<$FILE_VERIFY_STYLE_FILENAME_DEFAULT_LOCN>} .FileVerify_CantAccess {<$FILE_STYLE_TEXT_ERROR>} .FileVerify_OK {<$FILE_STYLE_TEXT_OK>} .FileVerify_MisMatch {<$FILE_STYLE_TEXT_ERROR>} .FileVerifyNoActiveX {<$FILE_STYLE_TEXT_ERROR>} .FileVerifyProductErr {<$FILE_STYLE_TEXT_ERROR>} .FileVerifyProductOK {<$FILE_STYLE_TEXT_OK>} #) #( '<?NewLine>' #define? FILE_STYLES_VERIFY_COMPONENT_CHECKS .FileVerify_ComponentUnmanaged {} .FileVerify_ComponentNotInstalledAndFileDoesntExist {<$FILE_STYLE_TEXT_OK>} .FileVerify_ComponentInstalledAndFileOk {<$FILE_STYLE_TEXT_OK>} .FileVerify_GuidUnknown {<$FILE_STYLE_TEXT_ERROR>} .FileVerify_ComponentNotInstalledButFileOk {<$FILE_STYLE_TEXT_ERROR>} .FileVerify_ComponentNotInstalledAndFileDoesntMatch {<$FILE_STYLE_TEXT_ERROR>} .FileVerify_ComponentInstalledButFileDoesntMatch {<$FILE_STYLE_TEXT_ERROR>} #)
EXAMPLES |
;--- Add files to a specific component --- <$Component "MainFiles" Create="Y" Directory_="INSTALLDIR"> ;--- Add ".MMH" (header) files --- <$FilesExclude "SelfReg*.mmh" EXLIST="NotThese"> ;;Don't include these! <$Files "*.mmh" EXLIST="NotThese"> <$/Component> ;--- Now add a whole directory tree automatically creating components --- <$Files 'c:\SourceTree\*.*' SubDir='TREE' DestDir='INSTALLDIR'>