Symbian3/SDK/Source/GUID-C5F9AAD3-5183-57E5-A33B-032DE3C063AE.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE reference
  PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
<reference id="GUID-C5F9AAD3-5183-57E5-A33B-032DE3C063AE" xml:lang="en"><title>Functions</title><abstract><p>The following functions can be used in PKG file: </p> <ul>
<li id="GUID-D0F2AEDF-9A04-512A-B0EB-913ECDE5FD09"><p> <codeph>package()</codeph>:
Tests for the existence of an installed package. </p> </li>
<li id="GUID-1D19648D-F906-525A-B25E-42A84D481425"><p> <codeph>exists()</codeph>:
Tests for the existence of a file or a non-root folder. </p> </li>
<li id="GUID-63990301-2907-5265-8EE0-8E93AE7B06D1"><p> <codeph>appprop()</codeph>:
Retrieves the properties from a registry entry. </p> </li>
<li id="GUID-61E19BBA-8DD1-5AAF-ACBE-6705F7E4F2B4"><p> <codeph>version()</codeph>:
Tests for the existence of an installed package version. </p> </li>
</ul></abstract><prolog><metadata><keywords/></metadata></prolog><refbody>
<section><title>package ()</title> <p>The <codeph>package()</codeph> function
returns true if a package with the specified UID is installed, returns false
otherwise. </p> <p>The following example code installs <filepath>foo.txt</filepath> if
a package exists with package UID <codeph>0x11223344</codeph>. </p> <codeblock id="GUID-49A08579-B63B-5F62-8C4E-33D2BCD30F67" xml:space="preserve">IF package(0x11223344)
"foo.txt"-"c:\foo.txt"
ENDIF</codeblock> </section>
<section><title>exists()</title> <p>In the following example code, the <codeph>exists()</codeph> function
installs the <filepath>exists.txt</filepath> file, if <filepath>test.txt</filepath> exists. </p> <codeblock id="GUID-2B7215C3-94AF-5440-A721-94A0E9559440" xml:space="preserve">if exists("c:\test.txt")    
    "text\exists.txt"-"!:\private\01234567\exists.txt"
endif</codeblock> </section>
<section><title>appprop()</title> <p>The first parameter to the <codeph>appprop()</codeph> function
must be the package UID of the package file, in which the property is defined.
The second parameter must be the property ID (<codeph>propid</codeph>) for
which the property is to be retrieved. </p> <p>The following example code
tests the capabilities of another PKG file on which it is dependent: </p> <codeblock id="GUID-B74003A5-FACD-5BD6-8EF1-12309D757904" xml:space="preserve">;Dependencies
(0x10000003), 1, 2, 3, {"Depend-EN"}

if (appprop(0x10000003,0) = 1)
   "text\appprop1.txt"-"!:\Documents\appprop1.txt" 
elseif (appprop(0x10000003,0) = 2)
   "text\appprop2.txt"-"!:\Documents\appprop2.txt" 
endif</codeblock> </section>
<section><title>version()</title> <p>The <codeph>version ()</codeph> function
returns true if the specified package exists on the Symbian device and its
version satisfies the condition specified by the function parameters. Otherwise,
it returns false. </p> <p>In the following example, if the package with pUID
0x10000042 is installed on the device and its version is less than 1.1.1,
the condition returns true. If the package does not exist or the package version
does not satisfy the condition, it returns false: </p> <codeblock id="GUID-B328B82C-27F2-5BD0-BEC3-FCDAB68BDE56" xml:space="preserve">if version(0x10000042,&lt;,1,1,1)
  "text\config.txt"-"!:\private\10000042\import\InstTest\config.txt"
endif
</codeblock> </section>
</refbody></reference>