コード例 #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
ファイル: 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;
	}
コード例 #3
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"));

	}