コード例 #1
0
ファイル: t_dcnone.cpp プロジェクト: kuailexs/symbiandump-os1
LOCAL_C void ScanDir(const TDesC& aName, CDirScan::TScanDirection aDirection, TInt aError)
	{
	CDirScan* scanner = NULL;
	TRAP(r, scanner = CDirScan::NewL(TheFs));
	test_Value(r, r == KErrNone && scanner);

	TRAP(r, scanner->SetScanDataL(aName,KEntryAttDir,ESortByName|EAscending,aDirection));
	test_KErrNone(r);
	
	CDir *entryList=NULL;
	for (;;)
		{
		TRAP(r, scanner->NextL(entryList));
		test_Value(r, r == aError);
		if (entryList==NULL)
			break;
		TInt count=entryList->Count();
		while (count--)
			{
			TEntry data=(*entryList)[count];
			TBuf<KMaxFileName> path=scanner->AbbreviatedPath();
			dirName = path;
			dirName.Append(data.iName);
			test.Printf(_L("    %S\n"),&dirName);
			
			}
		delete entryList;
		entryList=NULL;
		}
	delete scanner;

	}
コード例 #2
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 );
    }
コード例 #3
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);
			}
		}
	}
コード例 #4
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
	}
コード例 #5
0
ファイル: t_dcnone.cpp プロジェクト: kuailexs/symbiandump-os1
LOCAL_C void ListDirs()
//
// List the directories and files on the disk, without DC (so we
// find all of them), saving them in gDirList[] apart from
// members of the System and Private ones.
//
	{
	CDirScan* scanner = NULL;
	TInt r;
	TRAP(r, scanner = CDirScan::NewL(TheFs));
	test_Value(r, r == KErrNone && scanner);
	TParse dirName;
	TheFs.Parse(_L("\\"),dirName);
	TRAP(r, scanner->SetScanDataL(dirName.FullName(),KEntryAttDir,ESortByName|EAscending));
	test_KErrNone(r);
	CDir *entryList;
	test.Printf(_L("------ ALL DIRECTORIES ------\n"));
	for (;;)
		{
		scanner->NextL(entryList);
		if (entryList==NULL)
			break;
		TInt count=entryList->Count();
		while (count--)
			{
			TEntry data=(*entryList)[count];
			TBuf<KMaxFileName> path=scanner->AbbreviatedPath();
			gDirList[gDirNum] = path;
			gDirList[gDirNum].Append(data.iName);
			test.Printf(_L("    %S\n"),&gDirList[gDirNum]);
			gDirNum++;
			}
		delete entryList;
		entryList=NULL;
		}
	delete scanner;
	}
コード例 #6
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);
}
コード例 #7
0
ファイル: t_dcnone.cpp プロジェクト: kuailexs/symbiandump-os1
LOCAL_C void TestDirs()
//
// Scan directories and files with DC on, so only the root \Private
// and \System directories should be found (no contents).
//
	{

	MakeDirs();
	ListDirs();

	CDirScan* scanner = NULL;
	TInt r;
	TRAP(r, scanner = CDirScan::NewL(TheFs));
	test_Value(r, r == KErrNone && scanner);
	TParse dirName;
	TheFs.Parse(_L("\\"),dirName);
	TRAP(r, scanner->SetScanDataL(dirName.FullName(),KEntryAttDir,ESortByName|EAscending));
	test_KErrNone(r);
	CDir *entryList = NULL;
	TInt  num = 0;
	test.Printf(_L("------ ACCESSIBLE DIRECTORIES ------\n"));
	for (;;)
		{
		TRAP(r, scanner->NextL(entryList));
		if (r != KErrNone)
			{
			test.Printf(_L("*** ERROR %d doing NextL()\n"), r);
			break;
			}
		if (entryList==NULL)
			break;
		TInt count=entryList->Count();
		while (count--)
			{
			TEntry data=(*entryList)[count];
			TBuf<KMaxFileName> path=scanner->AbbreviatedPath();
			path.Append(data.iName);
			if (path == gDirList[num])
				{
				test.Printf(_L("%S\n"),&path);
				num++;
				}
			else
				{
				test.Printf(_L("%S *** NOT FOUND ***\n"),&path);
				}
			}
		delete entryList;
		entryList=NULL;
		}
	delete scanner;
	CleanDirs();
	test_KErrNone(r);
	if (num < gDirNum)
		{
		test.Printf(_L("Directory not as expected (%d found < %d expected\n"), num, gDirNum);
		test(0);
		}
	test.Printf(_L("------------------------------------\n"));

	}