How to implement CompleteWithAppPath?

Login to reply to this topic.
Wed, 2008-02-13 06:57
Joined: 2007-11-01
Forum posts: 14

How to know which driver my application installed on?


Wed, 2008-02-27 21:45
Joined: 2003-09-29
Forum posts: 32
Re: How to implement CompleteWithAppPath?

One option could be to find full path to the application executable using RApaLsSession and taking the drive letter from there, but for that you will need AllFiles capability from Symbian 9.x onwards.

const TUint32 KApplicationUid = 0x1234abcd;

RApaLsSession lsSession;
User::LeaveIfError(lsSession.Connect());
CleanupClosePushL(lsSession);

TApaAppInfo appInfo;
User::LeaveIfError(lsSession.GetAppInfo(appInfo, TUid::Uid(KApplicationUid)));
TChar drive = appInfo.iFullName[0];

CleanupStack::PopAndDestroy(&lsSession);

other would be to simply try where the executable is:

RFs fs;
User::LeaveIfError(fs.Connect());
CleanupClosePushL(fs);

TFileName executable(_L("!:\\sys\\bin\\NameOfTheExecutable.exe"));

TChar drive;
TBool driveFound = EFalse;
for (drive = 'a; drive <= 'z' && !driveFound; ++drive)
    {
    executable[0] = drive;

    TEntry dummy;
    if (fs.Entry(executable, dummy) == KErrNone)
        {
        driveFound = ETrue;
        }
    }'

CleanupStack::PopAndDestroy(&fs);

Of course, you might not want to search all the way from a to z, but you get the idea.

The second method does not seem so nice, but the first one does not work if the application does not have registration file.


Jari

Thu, 2008-02-28 06:07
Joined: 2007-08-31
Forum posts: 54
Re: How to implement CompleteWithAppPath?

Hi runforu,

one more solution is

TFileName FileName;
TParsePtrC parse(Application()->AppFullName());
FileName.Insert(0,parse.Drive());

for this AllFiles capability is not required

  • Login to reply to this topic.