文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>How to get private directory(转)

How to get private directory(转)

时间:2010-12-11  来源:冰岛

The <sid> is the Secure ID of the application. It is defined in the .mmp file. The following example shows how to get the path of the private folder of an application. For example, if an application has SID of 0x20001978, the private folder would be \private\20001978. The function that is used to get the private folder is RFs::PrivatePath().

[edit]Example

const TInt KPathNameLength = 100;
TBuf< KPathNameLength > pathWithoutDrive;
TBuf< KPathNameLength > driveAndPath;
TBuf< 2 > appDrive;

// Get application's private path
// This is e.g. '\Private\20001978\'
// Does not contain drive.
iEikonEnv->FsSession().PrivatePath( pathWithoutDrive );

// Extract drive letter into appDrive:
appDrive.Copy(CEikonEnv::Static()->EikAppUi()->Application()->AppFullName().Left(2));

// Combine drive letter and private path
driveAndPath.Copy(appDrive);
driveAndPath.Append(pathWithoutDrive);

// Now driveAndPath contains e.g. 'E:\Private\20001978\'

[edit]Example 2

#include <f32file.h>
TInt GetPrivatePath(TFileName& privatePath)
{
TFileName KPath;
RFs fsSession;
TInt result;
result = fsSession.Connect();
if (result != KErrNone)
return result;
fsSession.PrivatePath(KPath);
TFindFile findFile(fsSession);
privatePath = KPath;
result = findFile.FindByDir(KPath, KNullDesC);
if (result == KErrNone)
privatePath = findFile.File();
fsSession.Close();
return result;
}

The code must be linked with efsrv.lib. The resulting path contains backslash at the end.

相关阅读 更多 +
排行榜 更多 +
爱是小事最新版

爱是小事最新版

休闲益智 下载
悬案2刹那惊颤游戏

悬案2刹那惊颤游戏

冒险解谜 下载
几何飞行内购修改版

几何飞行内购修改版

飞行射击 下载