please help me to code the following scenario:

  1. On the Directory Parameter page user types in or selects a default value for the installation directory.
  2. my code needs to check that entered value
  3. Upon user clicking 'Next', if my code detects that there is previous install of the product at the location entered in Step 1, then prompt the user to either uninstall at that location, or ask to enter a different location. Do not go to the 'Next' page, i.e. do not continue the installation.
  4. If user chooses to uninstall, then exit the installer.
  5. If user re-enteres new location, then repeat validation starting from Step 3.
  6. Do not continue install until my code validates that the enetered location has no previous install in it.

Thank you.

asked 12 Sep '13, 21:30

Sasha's gravatar image

accept rate: 0%

It is possible to use <postShowPageActionList> to perform cheks for existence of specific file - such as uninstall.dat, which is the InstallBuilder uninstaller data file. Then using next_page it is possible to not allow continuing. For example:

<postShowPageActionList> <if> <actionList> <showQuestion> <default>no</default> <text>Do you want to uninstall the application first?</text> <variable>installdir_exists_answer</variable> </showQuestion> <if> <actionList> <exit> <exitCode>1</exitCode> </exit> </actionList> <conditionRuleList> <isTrue> <value>${installdir_exists_answer}</value> </isTrue> </conditionRuleList> <elseActionList> <setInstallerVariable> <name>next_page</name> <value>same</value> </setInstallerVariable> </elseActionList> </if> </actionList> <ruleList> <fileExists> <path>${installdir}/uninstall.dat</path> </fileExists> </ruleList> </if> </postShowPageActionList>

The example can also be customized to run uninstaller and go back to same page instead of simply exiting. For example:

<if> <actionList> <if> <actionList> <runProgram> <program>${installdir}/uninstall.app/Contents/MacOS/installbuilder.sh</program> <programArguments>&amp;</programArguments> </runProgram> </actionList> <conditionRuleList> <platformTest> <type>osx</type> </platformTest> </conditionRuleList> <elseActionList> <runProgram> <program>${installdir}/uninstall.${platform_exec_suffix}</program> <programArguments>&amp;</programArguments> </runProgram> </elseActionList> </if> <setInstallerVariable> <name>next_page</name> <value>same</value> </setInstallerVariable> </actionList> <conditionRuleList> <isTrue> <value>${installdir_exists_answer}</value> </isTrue> </conditionRuleList> <elseActionList> <setInstallerVariable> <name>next_page</name> <value>same</value> </setInstallerVariable> </elseActionList> </if>

This is the condition after the <showQuestion> with the updated actions.


answered 13 Sep '13, 08:30

wojciechka's gravatar image

wojciechka ♦♦
accept rate: 26%

edited 16 Sep '13, 03:36

Thank you. The solution you offered works just right for the needs we have. Yes, that would be helpful, too, if you give me a scetch for the uninstaller portion,as you mentioned: "The example can also be customized to run uninstaller and go back to same page instead of simply exiting." Thank you.

(16 Sep '13, 02:46) Sasha

I have updated the code above to provide example with also running the uninstaller.

(16 Sep '13, 07:57) wojciechka ♦♦
Your answer
toggle preview

Follow this question

By Email:

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



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



Asked: 12 Sep '13, 21:30

Seen: 925 times

Last updated: 16 Sep '13, 07:57