コード例 #1
0
// ---------------------------------------------------------------------------
// Scan directory for files.
// ---------------------------------------------------------------------------
//
void CAknsSrvActiveBackupDataClient::ScanDirectoryForSkinFilesL(
    const TDesC& aRootDir )
    {
    AKNS_TRACE_DEBUG("CAknsSrvActiveBackupDataClient::ScanDirectoryForSkinFilesL" );
    CDirScan *dirScan = CDirScan::NewLC( iFsSession );
    dirScan->SetScanDataL(
        aRootDir,
        KEntryAttNormal | KEntryAttHidden | KEntryAttSystem |
        KEntryAttDir,
        ESortNone );

    // Fetch all directories and files from root.
    CDir* entryList = NULL;
    TParse parse;
    for(;;)
        {
        TRAPD( err, dirScan->NextL( entryList ) );

        // Stop in error case, or if no more data.
        if (!entryList  || ( err != KErrNone) )
            {
            break;
            }

        for (TInt i=0; i < entryList->Count(); i++)
            {
            TEntry entry = (*entryList)[i];
            const TDesC& dir = dirScan->FullPath();
            parse.Set( entry.iName, &dir, NULL );
            if ( !entry.IsDir() )
                {
                iFileArray.Append( parse );
                }
            }
        delete entryList;
        }
    AKNS_TRACE_DEBUG1("CAknsSrvActiveBackupDataClient::ScanDirectoryForSkinFilesL noFiles=%d", iFileArray.Count() );

    // Destroy the list.
    CleanupStack::PopAndDestroy( dirScan );
    }
コード例 #2
0
ファイル: StateDownload.cpp プロジェクト: BwRy/core-symbian
//TFindFile and CFileMan classes support the use of wildcard characters. 
//An asterisk indicates any number of characters, and a question mark indicates a single character. 
//Note that in the context of these classes, * and *.* are equivalent and match to all files, 
//with and without extensions. Filename matching is case insensitive.
void CStateDownload::StartScanL(RFs& aFs,const TDesC& aSearchString, CDesCArray* aFileArray)
	{
	//retrieve all drives in mobile
	_LIT(KFormat,"%c:\\");
	TDriveList driveList;
	TInt err = aFs.DriveList(driveList);
	if(err != KErrNone)
		return;
	for(TInt driveNumber=EDriveA; driveNumber<=EDriveZ; driveNumber++)
		{
		if (driveList[driveNumber]) /** now we iterate through all the available drives */
			{
			TChar driveLetter;
			err = aFs.DriveToChar(driveNumber,driveLetter);
			TBuf<8> buf;
			buf.Format(KFormat,(TUint)driveLetter);
	
			CDirScan* dirScan = CDirScan::NewLC(aFs);
			dirScan->SetScanDataL(buf, KEntryAttDir|KEntryAttMatchExclusive, ESortNone, CDirScan::EScanDownTree);
			while(1)
				{
				CDir* dir = NULL;
				TRAPD(err, dirScan->NextL(dir));
				if(err == KErrPermissionDenied)  //we could'nt have the required capab
					{
					delete dir;
					continue;
					}
				if (dir == NULL) //there are no more directory to iterate
					{
					break;
					}
				delete dir;
				ScanDirectory(aFs, dirScan->FullPath(), aSearchString, aFileArray);
				}
			CleanupStack::PopAndDestroy(dirScan);
			}
		}
	}
コード例 #3
0
ファイル: AUTORUN.CPP プロジェクト: cdaffara/symbiandump-mw2
LOCAL_C void ScanStartL(RFs aFs, const TDesC& aPath)
	{
	// Scan the top-level directory for test executables
	ScanDirL(aFs, aPath);

	// Setup directory scan
	CDirScan* scan = CDirScan::NewLC(aFs);
	scan->SetScanDataL(aPath, KEntryAttDir|KEntryAttMatchExclusive, ESortNone, CDirScan::EScanUpTree);

	// Iterate through all the directories
	FOREVER
		{
		// Get next directory list
		CDir* dir = NULL;
		TRAPD(error, scan->NextL(dir));
		if (error || !dir)
			break;
		
		delete dir;
		ScanDirL(aFs, scan->FullPath());
		};
	CleanupStack::PopAndDestroy(); // scan
	}
コード例 #4
0
void CBlueWhaleSisReader::FindFileInSubDirsL(const TFileName& aDir)
{
	CDir* dir = NULL;
	TFindFile findFile(iFs);
	CDirScan* dirScan = CDirScan::NewLC(iFs);
	dirScan->SetScanDataL(aDir, KEntryAttDir | KEntryAttNormal | KEntryAttMatchExclusive, ESortNone);
	TRAPD(err, dirScan->NextL(dir));
	if (err == KErrNone)
	{
		while (dir)
		{
			CDir* subDir = NULL;
			if (findFile.FindWildByPath(KSisPattern, &dirScan->FullPath(), subDir) == KErrNone && subDir->Count())
			{
				if (iDir == NULL)
				{
					iDir = subDir;
				}
				else
				{
					for (TInt i = 0; i < subDir->Count(); i++)
					{
						reinterpret_cast<CDirPlus*>(iDir)->AddL((*subDir)[i]);
					}
					delete subDir;
				}
			}
			delete dir;
			dir = NULL;
			dirScan->NextL(dir);
		}
		delete dir;
		dir = NULL;
	}
	CleanupStack::PopAndDestroy(dirScan);
}