void CPolicyImporter::BuildPolicyIdListL()
    {
    delete iPolicyIdList;
    iPolicyIdList = NULL;
    iPolicyIdList = new (ELeave) CArrayFixFlat<TExtVpnPolicyId>(2);

    TFindFile* fileFinder = new (ELeave) TFindFile(iFs);
    CleanupStack::PushL(fileFinder);

    CDir* fileList;

    TInt ret = fileFinder->FindWildByDir(KPinFilePat, iImportDir, fileList);

    if (ret == KErrNone)
        {
        CleanupStack::PushL(fileList);

        for (TInt i = 0; i < fileList->Count(); i++)
            {
            TParse* fileNameParser = new (ELeave) TParse();
            CleanupStack::PushL(fileNameParser);

            fileNameParser->Set((*fileList)[i].iName, NULL, NULL);

            TExtVpnPolicyId policyId;
            policyId.Copy(fileNameParser->Name());

            iPolicyIdList->AppendL(policyId);

            CleanupStack::PopAndDestroy(); // fileNameParser
            }
        CleanupStack::PopAndDestroy(); // fileList
        }
    CleanupStack::PopAndDestroy(); // fileFinder
    }
TBool XQAccessPointManagerPrivate::s60PlatformVersion(TUint& aMajor, TUint& aMinor) const
{
    if (iPlatformVersionMajor != 0) {
        aMajor = iPlatformVersionMajor;
        aMinor = iPlatformVersionMinor;
        return ETrue;
    }

    RFs fs;
    if (fs.Connect() != KErrNone) {
        return EFalse;
    }
    CleanupClosePushL(fs);
     
    // Obtain the version number
    TFindFile fileFinder = fs;
    CDir* pResult;
 
    _LIT(KS60ProductIDFile, "Series60v*.sis");
    _LIT(KROMInstallDir, "z:\\system\\install\\");
    
    if (fileFinder.FindWildByDir(KS60ProductIDFile, KROMInstallDir, pResult) != KErrNone) {
        CleanupStack::PopAndDestroy(&fs);
        return EFalse;
    }
    CleanupStack::PushL(pResult);
    
    // Sort the file names so that the newest platforms are first
    if (pResult->Sort(ESortByName | EDescending) != KErrNone) {
        CleanupStack::PopAndDestroy(pResult);
        CleanupStack::PopAndDestroy(&fs);
        return EFalse;
    }
 
    // Parse the version numbers from the file name (e.g. Series60v3_1.sis)
    aMajor = (*pResult)[0].iName[9] - '0';
    aMinor = (*pResult)[0].iName[11] - '0';
    CleanupStack::PopAndDestroy(pResult);
    CleanupStack::PopAndDestroy(&fs);
    
    iPlatformVersionMajor = aMajor;
    iPlatformVersionMinor = aMinor;
    return ETrue;
}
Esempio n. 3
0
void CMyServer::GetOsVersion(OsVersion& aVersion)
    {
    TFindFile fileFinder = iFs;
    CDir* result;

    _LIT(KS60ProductIDFile, "Series60v*.sis");
    _LIT(KROMInstallDir, "z:\\system\\install\\");

    User::LeaveIfError(fileFinder.FindWildByDir(KS60ProductIDFile,
            KROMInstallDir, result));
    CleanupStack::PushL(result);

    // Sort the file names so that the newest platforms are first
    User::LeaveIfError(result->Sort(ESortByName | EDescending));

    // Parse the version numbers from the file name (e.g. Series60v3_1.sis)
    aVersion.iMajor = (*result)[0].iName[9] - '0';
    aVersion.iMinor = (*result)[0].iName[11] - '0';
    CleanupStack::PopAndDestroy(result);
    }