Namespaces
Variants
Actions

Determining the application path using Symbian C++

Jump to: navigation, search
Article Metadata

Compatibility
Platform(s): S60 2nd Edition
S60 3rd Edition and later

Article
Created: User:Technical writer 1 (08 Aug 2008)
Last edited: hamishwillee (19 Sep 2012)

Contents

Description

The end user can install applications either on the C: (phone memory) or E: (memory card, flash, or hard disk) drive. Applications may need to be aware of their installation location. The way the installation location is determined depends on the S60 platform version.

Solution

S60 3rd Edition (and later)

From S60 3rd Edition onwards, all application binaries (EXE and DLL files) are stored under \sys\bin. To access this directory, the application needs AllFiles capability. Resources and data cannot be stored in this directory. Instead, applications have their own restricted view on the file system consisting of the directory subtree \private\<SID>\, where SID is a security identifier, unique to each process. Applications use their private directory to hold .ini, .mbm, .rsc, and data files. Other processes cannot access the directory without the AllFiles capability.

CompleteWithAppPath() will always return \sys\bin as the application installation path on S60 3rd Edition. To access application data files located in the application's private directory, a different way to construct the path is needed:

TFileName appPath;
TBuf<2> appDrive;
 
// Returns private path of this application
// in following format: \Private\<SID of the application>\
// (does not contain drive specification).

iEikonEnv->FsSession().PrivatePath( appPath );
 
// Extract drive letter into appDrive
appDrive.Copy(iEikonEnv->EikAppUi()->Application()->AppFullName().Left(2));
 
// Insert drive letter into path
appPath.Insert(0, appDrive);


S60 2nd Edition

On S60 2nd Edition, use the CompleteWithAppPath( TDes& aFileName ) method from aknutils.h. All the components that are specified in the given descriptor (drive letter, path, and file name including the extension) are returned in the result; any missing components (path and drive letter) are taken from the application path (<drive>:\system\apps\<application_name> directory).

#include <aknutils.h>
 
// Insert the full application path into the file name (fileName)
TFileName fullPath(fileName);
CompleteWithAppPath(fullPath); // from aknutils.h
This page was last modified on 19 September 2012, at 03:15.
439 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved