Files - Defining the distribution tree

## Files - Defining the distribution tree |
| up | next

On this tab of the Files steps you define your distribution tree.

| The distribution tree shows your file selections and the distribution directory structure created by you. The distribution tree is drag-and drop enabled. To move directories or file selections to a different place, just drag them with the mouse to the desired location. Also, read the instructions on how to edit an existing distribution tree. To check whether your definition actually produces the desired results, please go to the View results tab of the Files steps.

| The root of the distribution tree is labeled as "Installation directory". This is the directory where your application will be installed on the target system. The directory is dependent on user actions at the time of installation. In GUI installers a user can select an arbitrary directory where the application should be installed. For RPM media files, a user can override the default directory with command line parameters. For Unix archives, the files are simply extracted into a commmon top-level directory. Beneath the "Installation directory" you can add files or create folders: To create a folder, click on [New folder] at the top right border of the distribution tree or choose Files->New folder from install4j's main menu. A folder named "New Folder" will be created below the selected directory. If no directory is selected, it will be created below the "Installation directory" root node. Right after its creation, the default name is editable and you can enter the intended name of the folder. Confirm your entry with `Enter`. To configure further properties of the folder, you can edit the folder node to show the folder property dialog. To add files, click on [Add files] at the top right border of the distribution tree or choose Files->Add files from install4j's main menu. The file entry wizard will be displayed. In the first step of this wizard you choose whether you want to add a number of single files choose this wizard type if you collect a small number of files (possibly from different locations) into a single directory. Example: a number of support libraries from different directories are added into the top level directory `lib`. the contents of a directory and its subdirectories choose this wizard type if you want to recursively add the contents of a directory. You will have the possibility of excluding certain files and subdirectories and exclude files based on their file suffix. If you would like to specify different settings for one or several files in the included directory, you have to exclude them and add them as single files in the appropriate directory.

| Using user variables in the distribution tree allows you to make conditional includes: if a directory node resolves to the empty string after variable replacement, the directory and any contained entries will not be included in the distribution. if the source directory of a "contents of directory" node resolves to the empty string after variable replacement, no files will be included through that entry. if the file name of a single file node resolves to the empty string after variable replacement, no file will be included.

| Note: It causes an error if the installation paths for two files collide. For example, if you have added the contents of two different directories into the same folder in the distribution tree and both directories contain a file `file.txt`, building the project will fail with a corresponding error message. In this case, you have to exclude the file in one of the directory entries. This is only valid for files, sub-directory hierarchies on the other hand are merged and can overlap between multiple directory entries and explicitly added folders.

| To install to a directory not beneath the installation directory (such as the Windows system directory or /var/log) you have to write a custom action that uses the appropriate methods in the `InstallerContext` class to install this file. The generated uninstaller will keep track of files installed by custom code.