Symbian3/SDK/Source/GUID-C5F9AAD3-5183-57E5-A33B-032DE3C063AE.dita
changeset 0 89d6a7a84779
equal deleted inserted replaced
-1:000000000000 0:89d6a7a84779
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE reference
       
    11   PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd">
       
    12 <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>
       
    13 <li id="GUID-D0F2AEDF-9A04-512A-B0EB-913ECDE5FD09"><p> <codeph>package()</codeph>:
       
    14 Tests for the existence of an installed package. </p> </li>
       
    15 <li id="GUID-1D19648D-F906-525A-B25E-42A84D481425"><p> <codeph>exists()</codeph>:
       
    16 Tests for the existence of a file or a non-root folder. </p> </li>
       
    17 <li id="GUID-63990301-2907-5265-8EE0-8E93AE7B06D1"><p> <codeph>appprop()</codeph>:
       
    18 Retrieves the properties from a registry entry. </p> </li>
       
    19 <li id="GUID-61E19BBA-8DD1-5AAF-ACBE-6705F7E4F2B4"><p> <codeph>version()</codeph>:
       
    20 Tests for the existence of an installed package version. </p> </li>
       
    21 </ul></abstract><prolog><metadata><keywords/></metadata></prolog><refbody>
       
    22 <section><title>package ()</title> <p>The <codeph>package()</codeph> function
       
    23 returns true if a package with the specified UID is installed, returns false
       
    24 otherwise. </p> <p>The following example code installs <filepath>foo.txt</filepath> if
       
    25 a package exists with package UID <codeph>0x11223344</codeph>. </p> <codeblock id="GUID-49A08579-B63B-5F62-8C4E-33D2BCD30F67" xml:space="preserve">IF package(0x11223344)
       
    26 "foo.txt"-"c:\foo.txt"
       
    27 ENDIF</codeblock> </section>
       
    28 <section><title>exists()</title> <p>In the following example code, the <codeph>exists()</codeph> function
       
    29 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")    
       
    30     "text\exists.txt"-"!:\private\01234567\exists.txt"
       
    31 endif</codeblock> </section>
       
    32 <section><title>appprop()</title> <p>The first parameter to the <codeph>appprop()</codeph> function
       
    33 must be the package UID of the package file, in which the property is defined.
       
    34 The second parameter must be the property ID (<codeph>propid</codeph>) for
       
    35 which the property is to be retrieved. </p> <p>The following example code
       
    36 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
       
    37 (0x10000003), 1, 2, 3, {"Depend-EN"}
       
    38 
       
    39 if (appprop(0x10000003,0) = 1)
       
    40    "text\appprop1.txt"-"!:\Documents\appprop1.txt" 
       
    41 elseif (appprop(0x10000003,0) = 2)
       
    42    "text\appprop2.txt"-"!:\Documents\appprop2.txt" 
       
    43 endif</codeblock> </section>
       
    44 <section><title>version()</title> <p>The <codeph>version ()</codeph> function
       
    45 returns true if the specified package exists on the Symbian device and its
       
    46 version satisfies the condition specified by the function parameters. Otherwise,
       
    47 it returns false. </p> <p>In the following example, if the package with pUID
       
    48 0x10000042 is installed on the device and its version is less than 1.1.1,
       
    49 the condition returns true. If the package does not exist or the package version
       
    50 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)
       
    51   "text\config.txt"-"!:\private\10000042\import\InstTest\config.txt"
       
    52 endif
       
    53 </codeblock> </section>
       
    54 </refbody></reference>