You can set a list of default installation directories depending on the target installation platform.

When the compiled installer is executed, IzPack chooses the default that matches the platform.

The prefix: TargetPanel.dir is used to specify variables related to setting the default installation directory.

IzPack recognizes this as a built-in variable which can be user-modified.

For example, change the resources to variables:

<resources>
  <res id="TargetPanel.dir.windows" src="@{izpack.dir.app}/installpath.windows.txt"/>
  <res id="TargetPanel.dir.unix" src="@{izpack.dir.app}/installpath.unix.txt"/>
</resources>

to

<variables>
  <variable name="TargetPanel.dir.windows" value="C:/MyApp"/>
  <variable name="TargetPanel.dir.unix" value="/usr/local/myapp"/>
</variables>

This uses the following variable search order to determine the default directory to display:

  1. TargetPanel.dir.<platform symbolic name> e.g. TargetPanel.dir.windows_7
  2. TargetPanel.dir.<platform name> e.g. TargetPanel.dir.windows
  3. TargetPanel.dir.<parent platform> e.g. given platform "FEDORA_LINUX" looks for TargetPanel.dir.linux, followed by TargetPanel.dir.unix
  4. TargetPanel.dir
  5. DEFAULT_INSTALL_PATH
  6. SYSTEM_user_dir corresponds to the system property "user.dir"

Available platforms can be found in the class Platforms. The names are the lowercase versions of those defined.
Allowed names include:

The DEFAULT_INSTALL_PATH variable is initialised to <PARENT_DIRECTORY>/$APP_NAME where <PARENT_DIRECTORY> is determined by:

OSParent Directory
WindowsProgramFiles environment variable
Mac OSX/Applications
Others/usr/local/ if writeable, or System.getProperty("user.home") if not

Changes from 4.3.6

The range of values the variable can have has been significantly enhanced, as per IZPACK-829.

Changes from earlier versions

Prior to 4.3.6, resources were used rather than variables. Resources were searched for with the following names

IZPACK-798 changed the above to use variables instead of text files, following the same naming convention.