|Windows Installer Basics: Directories|
All directories that you wish to use and all of its parent directories must be defined in the "Directory" table. If its missing a directory definition then the msi validation step should pick it up, failing that you will probably see a "2756" error during installation.
MAKEMSI has the "Directory" command to create these entries and the "DirectoryTree" command to define all the parent directories as well as the one you want in one hit.
Some directory related commands are:
Some directory related pages are:
|Remember the Install location|
This shows one way you can insure that the install location (in this case "INSTALLDIR") is remembered but defaults to a good value the first time:
;--- Create INSTALLDIR (remember where user wishes it installed) ------------ <$Property "INSTALLDIR" Persist="Y" PersistHow="PRODUCT FOREVER"> <$DirectoryTree Key="INSTALLDIR" Dir="[ProgramFilesFolder]\SomeProduct" CHANGE="\" PrimaryFolder="Y"> ...
Note that the "PropertyCa" was not needed in the above, if you need to "work out" the correct install location then it would probably be used to set the "INSTALLDIR" property's value (with or without the "DIR" parameter specified as "Y").
|Making Install Locations Adjustable at Install Time|
A user can choose to perform a custom setup in which case they will be presented with a list of one or more Features that they can choose to install, each one of these could potentially install software into a different location and allow the directory to be selected by the user.
If you wish to supply your own dialogs then have a look at the "Browse Dialog - Changing Directory" tip.
It is very important to keep in mind that its generally possible for the user to adjust directory locations at install time, either via custom setup or command line. If you must hard code something then please also ensure that you validate the environment ("yes there is a "K:" as an example) and that you don't allow users to adjust the value (or have a custom action to detect the change and abort with an error message).
If you do any fancy directory manipulation or allow people to specify directory locations, I highly recommend that you confirm the value of the directories "property" during install, repair and uninstall (see the "Install - Verbose Logging" option). Confirm that files and shortcuts are removed as expected.