File Destination and Properties¶
This feature lets you specify custom properties for each file of the package: custom destination folder, conditional variable and uninstall options.
Accessing the file properties editor¶
First you need to open the file manager. Then in the list select the file you want to edit the properties, and finally press the Properties button to show the editor. You can both edit the properties of a single file or a group of files.
Here is a screenshot of the file properties editor:
Where to extract the selected file(s)?¶
You can use this field to specify the path to the target folder for the extracted file. If you leave this field blank, the package will unpack the file into the default destination folder or in the corresponding sub-folder if the directory structure is stored into the archive (see the warning below).
To change this target folder, enter the path (no filename) where you want to place the extracted file. You should always use a variable for this field (absolute paths are not recommended): use the combo box to display the list of available folder variables pointing to system folders like User Desktop, Common Files, System Folder... See the list of available path variables.
For example, you can select your shared .DLL files and set their destination folder to
%SYS% which refers to the System folder. On the screenshot, the selected files will be unpacked to %COMTEMPLATESDIR%\The templates.
If you enable the "Store Path Information" option and you specify a target folder, then that stored path information will not be restored when extracting files. The target folder actually supersedes the default destination path of its associated files
See this example:
Any path variable can be used; there is a lot of possibilities. For example, you could read the destination path from the Registry in a variable using a custom action, and then use that variable as the target folder.
Is there a condition to extract the selected file(s)?¶
In some cases you may need to control whether a given file should be extracted or not. For example, if a shared file is missing on the destination computer or in case you want to install the registered version of your product only if the user has entered the correct registration key...
It is possible to decide at runtime whether a file can be extracted or not. It requires you to associate a variable called Conditional Variable to the file. Thus the file will be extracted or not, depending on the value (Boolean type) of its conditional variable.
Just enter the variable name in the "Conditional Variable" field: you may also use the Variable Manager to select an existing variable by pressing the button.
Before extracting this file, the package will evaluate the value of the associated conditional variable (if any): if its value is set to "0" (false), then the file is ignored.
Now you need to add an action (generally "Perform operation on a variable") to the custom action list (and before the file extraction phase of course) that sets the value of the conditional variable: if the value is equal to 0, then the file will not be extracted. Otherwise it will be unpacked.
To reset the file properties list (clear all changes), right-click the list to get the context menu and select the option "Clear Files Properties".
Component Variables and Conditional Variables¶
If files belong to a component, then their extraction may depend on the value of the component's variable. If you use the two features (both components + conditional variable) they may interfere: that's why it was decided that conditional variables outclasses the component variables.
Suppose that we have a file belonging to a component and associated to a conditional variable. For example, the component variable is set to 0 (false): if the conditional variable is set to "1", the file will be extracted.
See this diagram:
Do not remove the file when uninstalling the package¶
This option is useful only if you include an uninstaller for the package.
By default the uninstaller will remove any file extracted by the package (except if it was marked as shared). If you do not want the uninstaller to remove the selected file(s), then activate this option.