How do I make the installer display an error message to the user under certain circumstances?
You can make the installer display an error message to the user if certain conditions are met using a throwError action. Those conditions are expressed by rules as explained in the conditional evaluation chapter of the product documentation included with InstallBuilder. If used inside a parameter <validationActionList>
section, an error message will be displayed to the user and the user will be prompted again for the required information. If used in any other action list section, such as <preInstallationActionList>
, it will display an error message to the user and the application will exit. The following example code, when placed in <preInstallationActionList>
will throw an error and abort the installation if the Apache configuration file is not writable by the current user:
<throwError>
<text>The Apache configuration file is not writable by the current user</text>
<ruleList>
<fileTest>
<path>/usr/local/apache/conf/httpd.conf</path>
<condition>not_writable</condition>
</fileTest>
</ruleList>
</throwError>