Functions

The following functions can be used in PKG file:

  • package() : Tests for the existence of an installed package.

  • exists() : Tests for the existence of a file or a non-root folder.

  • appprop() : Retrieves the properties from a registry entry.

  • version() : Tests for the existence of an installed package version.

package ()

The package() function returns true if a package with the specified UID is installed, returns false otherwise.

The following example code installs foo.txt if a package exists with package UID 0x11223344 .

       
        
       
       IF package(0x11223344)
"foo.txt"-"c:\foo.txt"
ENDIF
      

exists()

In the following example code, the exists() function installs the exists.txt file, if test.txt exists.

       
        
       
       if exists("c:\test.txt")    
    "text\exists.txt"-"!:\private\01234567\exists.txt"
endif
      

appprop()

The first parameter to the appprop() function must be the package UID of the package file, in which the property is defined. The second parameter must be the property ID ( propid ) for which the property is to be retrieved.

The following example code tests the capabilities of another PKG file on which it is dependent:

       
        
       
       ;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
      

version()

The version () 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.

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:

       
        
       
       if version(0x10000042,<,1,1,1)
  "text\config.txt"-"!:\private\10000042\import\InstTest\config.txt"
endif