Beispiel #1
0
extern "C" char * GetConstPrivatePath(void)
{
    TFileName privatePath;
    TBuf8<KMaxFileName> privatepathutf8;
    size_t len;
    char carray[KMaxFileName];

    if (GetPrivatePath(privatePath) != KErrNone)
    {
        return strdup("C:\\Data\\Others");
    }

    CnvUtfConverter::ConvertFromUnicodeToUtf8( privatepathutf8, privatePath );

    TInt index = 0;
    for (index = 0; index < privatepathutf8.Length(); index++)
    {
        carray[index] = privatepathutf8[index];
    }
    carray[index] = 0;

    if ((len = strnlen((const char *)carray, KMaxFileName) < KMaxFileName))
    {
        carray[len-1] = '\0';
        return strdup((const char *)carray);
    }
    else
    {
        return strdup("C:\\Data\\Others");
    }
}
TInt CSecMgrStore::GetPolicyPath(TDes& aFile)
	{
	TInt ret(GetPrivatePath (aFile));

	if ( KErrNone==ret)
		{
		aFile.Append (KPolicyDir);
		aFile.Append (KDirSeparator);

		TRAP (ret, BaflUtils::EnsurePathExistsL (iFsSession, aFile));
		}

	return ret;
	}
TInt CSecMgrStore::GetScriptPath(TDes& aFile)
	{
	TInt ret(GetPrivatePath (aFile));

	if ( KErrNone==ret)
		{
		aFile.Append (KScriptDir);
		aFile.Append (KDirSeparator);

		TRAP (ret, BaflUtils::EnsurePathExistsL (iFsSession, aFile));

		if ( KErrAlreadyExists==ret)
			ret = KErrNone;
		}

	return ret;
	}