36 _LIT(KDb7, "c:\\private\\10281e17\\[98765432]t_invobject.db"); |
36 _LIT(KDb7, "c:\\private\\10281e17\\[98765432]t_invobject.db"); |
37 _LIT(KDb8, "c:\\private\\10281e17\\[98765432]t_2defaultpolicies.db"); |
37 _LIT(KDb8, "c:\\private\\10281e17\\[98765432]t_2defaultpolicies.db"); |
38 |
38 |
39 _LIT(KPrivateSubDir, "c:\\private\\10281e17\\cfg-TestDir.db\\"); |
39 _LIT(KPrivateSubDir, "c:\\private\\10281e17\\cfg-TestDir.db\\"); |
40 |
40 |
|
41 TParse TheParse; |
|
42 |
41 /////////////////////////////////////////////////////////////////////////////////////// |
43 /////////////////////////////////////////////////////////////////////////////////////// |
42 /////////////////////////////////////////////////////////////////////////////////////// |
44 /////////////////////////////////////////////////////////////////////////////////////// |
43 //Test macros and functions |
45 //Test macros and functions |
44 static void Check(TInt aValue, TInt aExpected, TInt aLine) |
46 static void Check(TInt aValue, TInt aExpected, TInt aLine) |
45 { |
47 { |
57 { |
59 { |
58 TInt err = BaflUtils::DeleteFile(aFs, aFilePath); |
60 TInt err = BaflUtils::DeleteFile(aFs, aFilePath); |
59 if(err != KErrNone && err != KErrNotFound) |
61 if(err != KErrNone && err != KErrNotFound) |
60 { |
62 { |
61 TheTest.Printf(_L("Error %d deleting \"%S\" file.\n"), err, &aFilePath); |
63 TheTest.Printf(_L("Error %d deleting \"%S\" file.\n"), err, &aFilePath); |
|
64 } |
|
65 } |
|
66 |
|
67 void PrintDiskUsage(RFs& aFs, const TDesC& aPath, TInt aOffset = 0) |
|
68 { |
|
69 _LIT(KSpace, " "); |
|
70 TheTest.Printf(_L("%*.*S%S\r\n"), aOffset, aOffset, &KSpace, &aPath); |
|
71 TFindFile findFile(aFs); |
|
72 CDir* fileNameCol = NULL; |
|
73 TBuf<8> fileNameMask; |
|
74 fileNameMask.Copy(_L("*.*")); |
|
75 TInt err = findFile.FindWildByDir(fileNameMask, aPath, fileNameCol); |
|
76 if(err == KErrNone) |
|
77 { |
|
78 do |
|
79 { |
|
80 const TDesC& file = findFile.File();//"file" variable contains the drive and the path. the file name in "file" is invalid in this case. |
|
81 (void)TheParse.Set(file, NULL, NULL); |
|
82 TPtrC driveName = TheParse.Drive(); |
|
83 if(aPath.FindF(driveName) >= 0) |
|
84 { |
|
85 TInt cnt = fileNameCol->Count(); |
|
86 for(TInt i=0;i<cnt;++i) |
|
87 { |
|
88 const ::TEntry& entry = (*fileNameCol)[i]; |
|
89 if(!entry.IsDir()) |
|
90 { |
|
91 TheTest.Printf(_L("%*.*S %S, size=%d\r\n"), aOffset, aOffset, &KSpace, &entry.iName, entry.iSize); |
|
92 } |
|
93 else |
|
94 { |
|
95 TBuf<100> path; |
|
96 path.Copy(aPath); |
|
97 path.Append(entry.iName); |
|
98 path.Append(_L("\\")); |
|
99 PrintDiskUsage(aFs, path, aOffset + 4); |
|
100 } |
|
101 } |
|
102 } // if(aPath.FindF(driveName) >= 0) |
|
103 |
|
104 delete fileNameCol; |
|
105 fileNameCol = NULL; |
|
106 } while((err = findFile.FindWild(fileNameCol)) == KErrNone);//Get the next set of files |
|
107 } |
|
108 else |
|
109 { |
|
110 TheTest.Printf(_L(" FindWildByDir() failed with err=%d\r\n"), err); |
62 } |
111 } |
63 } |
112 } |
64 |
113 |
65 void DoRun() |
114 void DoRun() |
66 { |
115 { |
83 DoDeleteFile(fs, KDb5); |
132 DoDeleteFile(fs, KDb5); |
84 DoDeleteFile(fs, KDb6); |
133 DoDeleteFile(fs, KDb6); |
85 DoDeleteFile(fs, KDb7); |
134 DoDeleteFile(fs, KDb7); |
86 DoDeleteFile(fs, KDb8); |
135 DoDeleteFile(fs, KDb8); |
87 |
136 |
88 //Create a subdir in the private datacage. The SQL production code should properly detects |
137 TheTest.Printf(_L("====================================================\r\n")); |
89 //KPrivateSubDir is a directory not a database file |
138 PrintDiskUsage(fs, _L("c:\\")); |
|
139 TheTest.Printf(_L("====================================================\r\n")); |
|
140 |
|
141 //Remove the created subdir in the private datacage. |
90 err = fs.RmDir(KPrivateSubDir); |
142 err = fs.RmDir(KPrivateSubDir); |
91 if(err != KErrNone && err != KErrNotFound) |
143 if(err != KErrNone && err != KErrNotFound) |
92 { |
144 { |
93 TheTest.Printf(_L("Error %d deleting \"%S\" directory.\n"), err, &KPrivateSubDir); |
145 TheTest.Printf(_L("Error %d deleting \"%S\" directory.\n"), err, &KPrivateSubDir); |
94 } |
146 } |