Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to install optional components

The package file can be used to specify a number of options to be offered to the user. The installation file performs different actions depending on the selected option, e.g. installs a different set of files.

The process is:

  1. Create a text file with extension .pkg.

  2. Specify the supported languages and the package header. These are discussed in the “How to” topics for a simple installation and for installing a multilingual application.

  3. Specify an options block. The block defines, in a comma separated block, the text identifying each option, and hence the number of options.

  4. For each option, specify the source and target destinations for the files to be installed. The files are specified in condition blocks between if optionx and endif condition statements. There is normally a condition block for every option defined in the option block.

  5. Specify the source and target destinations for any other files to be installed.

  6. Invoke the Installation File Generator on the package file.


See also

How to create a simple installation file, How to create an installation file for a multilingual application

[Top]


Example

The project file for an installation in which files may be conditionally installed is provided in epoc32ex\ToolsAndUtilities\HelloWorldOptions.pkg. A listing of the file is given below:

#{"Minimal application"},(0x10004299),1,0,0
  !({"Install sample document (1Kb)"},
  {"Install sample document2 (1Kb)"})

If option1
  "sample.txt"-"!:\Documents\sample.txt";
endif

if option2
  "sample2.txt"-"!:\Documents\sample2.txt";
endif

"HelloWorld.app"-"!:\system\apps\HelloWorld\HelloWorld.app"
"HelloWorld.rsc"-"!:\system\apps\HelloWorld\HelloWorld.rsc".

The package file installs exactly the same application as described in the “How to” for a simple installation. Consequently the package header, and the final lines in which the application files are installed are the same as for the simple installation.

However the installation also specifies two sample documents, either or both of which the user can choose to install.

The second line defines an option block with two options. The text in these options is displayed to the user at installation time. Note that the size of the file is displayed to the user in parenthesis, so that the user can judge the disk space cost of selecting the option.

The condition blocks control the installation of the sample files, depending on the user’s selection.

To create the installation file HelloWorldOptions.sis, invoke the Installation File Generator on the package file:

makesis HelloWorldOptions.pkg

[Top]


Notes: