How do I specify a different default installation directory for Unix and Windows?




  • Avatar

    Let's say you want to use c:myapp-4.0 for Windows and /usr/local/myapp-4.0 for Unix as the default installation directory. In InstallBuilder, go to "Advanced", locate the 'installdir' parameter under 'Parameters' (or create a new directoryParameter named 'installdir'), edit it and specify /usr/local/${product_shortname}-${product_version} as Installation Directory. Now go to the "XML Editor" tab and insert this code:

          <value>${env(SYSTEMDRIVE)}/${product_shortname}- ${product_version}</value>

    Remember that if you choose /usr/local as the destination for your application you have to require that the installation is performed as the root user. ${product_shortname} and ${product_version} are installer variables. You can find the complete list of the default installer variables available and their meaning in the product documentation included with InstallBuilder.

    Comment actions Permalink
  • Avatar

    I think this is outdated. I just downloaded the latest version of BitRock InstallBuilder Version: 8.5.0 (2012-08-06) and even though I can go into Customization->Installer I cannot find "Installation Directory". A little bit worse when I open up my project.xml file, I don’t see preInstallationActionList or setInstallerVariable. Am I missing something?

    Is there an easier way to change the default install path?

    Comment actions Permalink
  • Avatar

    This doesn't work for the defaults when using the generated installer in command line (non-GUI) mode. preInstallationActionList is not run before the help is printed out with the --help argument. Therefore the default value for installdir is output.

    We are looking at having to create separate XML files for Windows and Linux because of this. Any suggestions!?

    Comment actions Permalink
  • Avatar

    Another approach that can be used is to use a variable for the <default> value for installdir and set it in both <initializationActionList> and in <preShowHelpActionList> - so that it is used for installation and when user runs the installer with --help:

    <project> <!-- ... --> <initializationActionList> <if> <actionList> <setInstallerVariable> <name>default_installdir</name> <value>${platform_install_prefix}/${product_shortname} ${product_version}</value> </setInstallerVariable> </actionList> <conditionRuleList> <platformTest> <type>windows</type> </platformTest> </conditionRuleList> <elseActionList> <setInstallerVariable> <name>default_installdir</name> <value>${platform_install_prefix}/${product_shortname}-${product_version}</value> </setInstallerVariable> </elseActionList> </if> </initializationActionList> <parameterList> <directoryParameter> <name>installdir</name> <description>Installer.Parameter.installdir.description</description> <explanation>Installer.Parameter.installdir.explanation</explanation> <value></value> <default>${default_installdir}</default> <allowEmptyValue>0</allowEmptyValue> <cliOptionName>prefix</cliOptionName> <mustBeWritable>1</mustBeWritable> <mustExist>0</mustExist> <width>40</width> </directoryParameter> </parameterList> <preShowHelpActionList> <if> <actionList> <setInstallerVariable> <name>default_installdir</name> <value>${platform_install_prefix}/${product_shortname} ${product_version}</value> </setInstallerVariable> </actionList> <conditionRuleList> <platformTest> <type>windows</type> </platformTest> </conditionRuleList> <elseActionList> <setInstallerVariable> <name>default_installdir</name> <value>${platform_install_prefix}/${product_shortname}-${product_version}</value> </setInstallerVariable> </elseActionList> </if> </preShowHelpActionList> </project>

    Comment actions Permalink

Please sign in to leave a comment.