0
1

For example: What should I do if I want to set in Unix a different default installation directory than the one used in Windows?

asked 06 Sep '11, 04:14

Jake's gravatar image

Jake ♦♦
796222226235
accept rate: 98%


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:

<preInstallationActionList>
  <setInstallerVariable>
    <name>installdir</name>
      <value>${env(SYSTEMDRIVE)}/${product_shortname}- ${product_version}</value>
      <ruleList>
        <platformTest>
          <type>windows</type>
        </platformTest>
      </ruleList>
  </setInstallerVariable>
</preInstallationActionList>

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.

link

answered 06 Sep '11, 04:20

Jake's gravatar image

Jake ♦♦
796222226235
accept rate: 98%

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>

link

answered 09 Apr '14, 14:29

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
accept rate: 26%

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?

link

answered 20 Sep '12, 19:53

elmexicano's gravatar image

elmexicano
1
accept rate: 0%

We have updated the answer. The <preInstallationActionList> wont appear if it is empty so you will just need to paste the snippet as a child of the project. You could also just keep using the tree editor to add the <setInstallerVariable> action instead of directly editing the XML.

(21 Sep '12, 03:31) juanjo ♦♦

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!?

link

answered 09 Apr '14, 05:28

seanraby's gravatar image

seanraby
46272729
accept rate: 7%

Please see my answer below for an alternative approach. I hope this works fine for you.

(09 Apr '14, 14:30) wojciechka ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×40
×33
×10

Asked: 06 Sep '11, 04:14

Seen: 6,045 times

Last updated: 09 Apr '14, 14:30