Saturday, August 09, 2008

How to know where on device my application is installed.

As you may want to provide user to install you application both on phone memory (C:\) OR on memory Card (E:\) So when try to access your data files you may require to find out which drive your application is installed.

Pre-v9 SDK suppoerted devices.


TFileName fullPath(fileName);
CompleteWithAppPath(fullPath); // from aknutils.h
// fullPath now will contain <drive>:\system\apps\<application_name>
v9.x SDK suppoerted devices.

    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);

No comments:

stats counter