symbian中得到应用程序的路径

代码1:

void GetFullPathName(TDes& aFileName)
{
// Get default drive and path
TParse parse;
TFileName appPath;
TBuf<5> appDrive;
parse.Set(CEikonEnv::Static()->EikAppUi()->Application()->AppFullName(), NULL, NULL);
appPath.Copy(parse.DriveAndPath());
appDrive.Copy(parse.Drive());

// Parse the file name
parse.Set(aFileName, NULL, NULL);
if (parse.Drive().Length() == 0)
{
if (parse.Path().Length() == 0)
{ // Use default path and drive
aFileName.Insert(0, appPath);
}
else
{ // Use default drive
aFileName.Insert(0, appDrive);
}
}
}
 

代码2:

TFileName fullPath;
fullPath = iEikonEnv->EikAppUi()->Application()->AppFullName();
TParse parse;
parse.Set( fullPath,NULL,NULL );
fullPath.Copy( parse.DriveAndPath() );

猜你喜欢

转载自blog.csdn.net/ArtX/article/details/1780960