Directory Tree Specification |
This describes the formatting of a directory tree specification that some MAKEMSI commands and features use to specify directories, such as:
Internally Windows Installer uses directory aliases which represent the install time directory locations where files should be placed etc. If they are associated with features then the user can choose their own alternative location (override the default) at install time. If the alias is all upper case letters the user can override from the command line.
The MAKEMSI "Directory" command can be used to create these directory aliases but it can be very annoying creating directory trees since each "level" needs to be built individually (3 commands need for "a\b\c" etc).
You can supply a directory tree in these formats:
The key can be a system folder property such as "ProgramFilesFolder" (which may or may not be located at "C:\Program Files") or can be one you defined yourself (perhaps with the "DirectoryTree" command).
If the directory tree starts with "\" then the default "root" is used (specified in the "DIRTREE_ROOT" macro). This can contain something like "C:" or "[TARGETDIR]".
If you map to particular drives then you may want to look at the "Z: Available?" launch condition.
Where a drive letter and path is specified (and not "mapped", then that exact drive and path is used, for example, if you specify "C:\Program Files" then that is exactly where any files will go irrespective of any "ROOTDRIVE" or other approaches you might use. If the user has "Program Files" in a different location they will not be placed there (language can also play a part in the name of the standard folders)!
To spell it out, the use of (unmapped) drive letters should be the exception rather than the rule. They should only be used if you want the files to go exactly in that location no matter what the users country, language or configuration.
Note that you could map "C:\" to "[TARGETDIR]" if you wish.
UNC names such as "\\SomeServer\SomeShare\SomeDir" are not (yet) supported by this command but as directories can be mapped at install time with the "PropertyCa" this is only a minor issue.
Note that if your directory specification begins with "{" then you wish to specify a name for this directory (alternative to the use of the "NAME" parameter). The name is supplied in the form "{name}RealDirectoryName".
Naming Directories |
If you prefer particular names to be used in the MSI "Directory" table (possibly because you need to refer to it by key) then you do need to be careful about the order of definition.
When MAKEMSI defines a directory it works down the tree creating any required parent directories first. Whenever it has to create a directory it either uses an "internal" name or the one you chose (if last part of directory). However MAKEMSI does not recreate directories already created so you may not get the "key" that you wish, for example the "c:\tmp" in the following example is not named "TMP" as it was created in the first step, reverse these lines (you will get an error message when you can't name a directory).
<$DirectoryTree DIRECTORY="c:\tmp\tmp2" KEY="TMP2_DIR"> <$DirectoryTree DIRECTORY="c:\tmp" KEY="TMP">