persistentstorage/sql/TEST/t_sqlenvdestroy.cpp
branchRCL_3
changeset 18 3da531bb4329
parent 15 fcc16690f446
--- a/persistentstorage/sql/TEST/t_sqlenvdestroy.cpp	Wed Jun 09 11:36:09 2010 +0300
+++ b/persistentstorage/sql/TEST/t_sqlenvdestroy.cpp	Mon Jun 21 17:37:53 2010 +0300
@@ -38,6 +38,8 @@
 
 _LIT(KPrivateSubDir, "c:\\private\\10281e17\\cfg-TestDir.db\\");
 
+TParse TheParse;
+
 ///////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////
 //Test macros and functions
@@ -62,6 +64,53 @@
 		}
 	}
 
+void PrintDiskUsage(RFs& aFs, const TDesC& aPath, TInt aOffset = 0)
+	{
+	_LIT(KSpace, " ");
+	TheTest.Printf(_L("%*.*S%S\r\n"), aOffset, aOffset, &KSpace, &aPath);
+	TFindFile findFile(aFs);
+	CDir* fileNameCol = NULL;
+	TBuf<8> fileNameMask;
+	fileNameMask.Copy(_L("*.*"));
+	TInt err = findFile.FindWildByDir(fileNameMask, aPath, fileNameCol);
+	if(err == KErrNone)
+		{
+		do
+			{
+			const TDesC& file = findFile.File();//"file" variable contains the drive and the path. the file name in "file" is invalid in this case.
+			(void)TheParse.Set(file, NULL, NULL);
+			TPtrC driveName = TheParse.Drive();
+			if(aPath.FindF(driveName) >= 0)
+				{		
+                TInt cnt = fileNameCol->Count();
+                for(TInt i=0;i<cnt;++i)
+                    {
+                    const ::TEntry& entry = (*fileNameCol)[i];
+                    if(!entry.IsDir())
+                        {
+                        TheTest.Printf(_L("%*.*S    %S, size=%d\r\n"), aOffset, aOffset, &KSpace, &entry.iName, entry.iSize);
+                        }
+                    else
+                        {
+                        TBuf<100> path;
+                        path.Copy(aPath);
+                        path.Append(entry.iName);
+                        path.Append(_L("\\"));
+                        PrintDiskUsage(aFs, path, aOffset + 4);
+                        }
+                    }
+				} // if(aPath.FindF(driveName) >= 0)
+			
+			delete fileNameCol;
+			fileNameCol = NULL;
+			} while((err = findFile.FindWild(fileNameCol)) == KErrNone);//Get the next set of files
+		}
+	else
+		{
+		TheTest.Printf(_L("  FindWildByDir() failed with err=%d\r\n"), err);
+		}
+	}
+
 void DoRun()
 	{
     RFs fs;
@@ -85,8 +134,11 @@
 	DoDeleteFile(fs, KDb7);
 	DoDeleteFile(fs, KDb8);
 
-	//Create a subdir in the private datacage. The SQL production code should properly detects
-	//KPrivateSubDir is a directory not a database file
+	TheTest.Printf(_L("====================================================\r\n"));
+	PrintDiskUsage(fs, _L("c:\\"));
+	TheTest.Printf(_L("====================================================\r\n"));
+	
+	//Remove the created subdir in the private datacage. 
 	err = fs.RmDir(KPrivateSubDir);
 	if(err != KErrNone && err != KErrNotFound)
 		{