NlMakesis Y-Browser Y-Tasks
How to know which driver my application installed on?
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
Hi runforu,
one more solution is
TFileName FileName; TParsePtrC parse(Application()->AppFullName()); FileName.Insert(0,parse.Drive());
for this AllFiles capability is not required
Forum posts: 32
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
Forum posts: 54
Hi runforu,
one more solution is
TFileName FileName;
TParsePtrC parse(Application()->AppFullName());
FileName.Insert(0,parse.Drive());
for this AllFiles capability is not required