×
Namespaces

Variants
Actions
Revision as of 10:41, 23 July 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Getting application installation path

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: kiran10182 (07 May 2007)
Last edited: hamishwillee (23 Jul 2012)

End user can install application on either C: (Phone Memory) or E: (Memory Card- MMC). Sometimes programmers need to know which is the installation drive.


CompleteWithAppPath() from aknutils.h is used to determine installation path of the application.

void CYrContainer::GetFullPathL(const TFileName& aFileName)
{
TFileName completePath(aFileName);
// insert the full application path into the file name
 
CompleteWithAppPath(completePath); // from aknutils.h
 
 
//Just for displaying what we have got in 'completePath'
CAknInformationNote* info= new(ELeave) CAknInformationNote;
info->ExecuteLD(completePath);
 
// implement your own logic once you get complete path
.....
.....
}


Now call GetFullPathL() according to your requirements.

Following are some sample scenario which illustrate usage of CompleteWithAppPath().

Scenario 1:

We need to open/read Test.txt file which is supplied to application installation path.

_LIT(KMyFileName, "Test.txt");
TBuf16<50> FileName;
FileName.Copy(KMyFileName);
GetFullPathL(FileName);
 
 
-------------------------------------
Output: C:\System\apps\myapp\Test.txt
or
E:\System\apps\myapp\Test.txt

Scenario 2:

We need to open/read Test.txt file which is supplied to root directory.

If your file is located on root, then feed following path

_LIT(KMyFileName, "\\Test.txt");
TBuf16<50> FileName;
FileName.Copy(KMyFileName);
GetFullPathL(FileName);
 
 
-------------------
Output: C:\Test.txt
or
E:\Test.txt

Scenario 3:

We need to open/read Test.txt file which is supplied to \System folder.

If your file is located on \System, then feed following path:

_LIT(KMyFileName, "\\System\\Test.txt");
TBuf16<50> FileName;
FileName.Copy(KMyFileName);
GetFullPathL(FileName);
 
 
--------------------------------
Output: C:\System\Test.txt
or
E:\System\Test.txt
This page was last modified on 23 July 2012, at 10:41.
53 page views in the last 30 days.
×