117 @param aFs The file server session. |
113 @param aFs The file server session. |
118 |
114 |
119 @return A pointer to the new directory scan object. |
115 @return A pointer to the new directory scan object. |
120 */ |
116 */ |
121 { |
117 { |
122 OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANNEWLC, "sess %x", aFs.Handle()); |
118 TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanNewLC, MODULEUID, aFs.Handle()); |
123 |
119 |
124 CDirScan* scan=new(ELeave) CDirScan(aFs); |
120 CDirScan* scan=new(ELeave) CDirScan(aFs); |
125 CleanupStack::PushL(scan); |
121 CleanupStack::PushL(scan); |
126 scan->iStack=CDirStack::NewL(); |
122 scan->iStack=CDirStack::NewL(); |
127 |
123 |
128 OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANNEWLCRETURN, "CDirScan* %x", scan); |
124 TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanNewLCReturn, MODULEUID, scan); |
129 return scan; |
125 return scan; |
130 } |
126 } |
131 |
127 |
132 |
128 |
133 |
129 |
139 @param aFs The file server session. |
135 @param aFs The file server session. |
140 |
136 |
141 @return A pointer to the new directory scan object. |
137 @return A pointer to the new directory scan object. |
142 */ |
138 */ |
143 { |
139 { |
144 OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANNEWL, "sess %x", aFs.Handle()); |
140 TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanNewL, MODULEUID, aFs.Handle()); |
145 |
141 |
146 CDirScan* scan=CDirScan::NewLC(aFs); |
142 CDirScan* scan=CDirScan::NewLC(aFs); |
147 CleanupStack::Pop(); |
143 CleanupStack::Pop(); |
148 |
144 |
149 OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANNEWLRETURN, "CDirScan* %x", scan); |
145 TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanNewLReturn, MODULEUID, scan); |
150 return scan; |
146 return scan; |
151 } |
147 } |
152 |
148 |
153 |
149 |
154 |
150 |
158 Desctructor. |
154 Desctructor. |
159 |
155 |
160 Frees all resources owned by the object, prior to its destruction. |
156 Frees all resources owned by the object, prior to its destruction. |
161 */ |
157 */ |
162 { |
158 { |
163 OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANDESTRUCTOR, "this %x", this); |
159 TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanDestructor, MODULEUID, this); |
164 |
160 |
165 delete iStack; |
161 delete iStack; |
166 |
162 |
167 OstTrace0(TRACE_BORDER, EFSRV_ECDIRSCANDESTRUCTORRETURN, ""); |
163 TRACE0(UTF::EBorder, UTraceModuleEfsrv::ECDirScanDestructorReturn, MODULEUID); |
168 } |
164 } |
169 |
165 |
170 |
166 |
171 |
167 |
172 |
168 |
216 @param anEntrySortKey The order in which the directories are scanned by |
212 @param anEntrySortKey The order in which the directories are scanned by |
217 NextL(). This flag is defined in TEntryKey. |
213 NextL(). This flag is defined in TEntryKey. |
218 @param aScanDir The direction of the scan. The default is downwards. |
214 @param aScanDir The direction of the scan. The default is downwards. |
219 */ |
215 */ |
220 { |
216 { |
221 OstTraceExt4(TRACE_BORDER, EFSRV_ECDIRSCANSETSCANDATAL, "this %x anEntryAttMask %x anEntrySortKey %d aScanDir %d", (TUint) this, (TUint) anEntryAttMask, (TUint) anEntrySortKey, (TUint) aScanDir); |
217 TRACEMULT5(UTF::EBorder, UTraceModuleEfsrv::ECDirScanSetScanDataL, MODULEUID, (TUint) |
222 OstTraceData(TRACE_BORDER, EFSRV_ECDIRSCANSETSCANDATAL_EFILEPATH, "FilePath %S", aMatchName.Ptr(), aMatchName.Length()<<1); |
218 this, aMatchName, anEntryAttMask, anEntrySortKey, (TUint) aScanDir); |
223 |
219 |
224 TInt r = Fs().Parse(aMatchName,iFullPath); |
220 TInt r = Fs().Parse(aMatchName,iFullPath); |
225 if (r != KErrNone) |
221 if (r != KErrNone) |
226 { |
222 { |
227 OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANSETSCANDATALRETURN1, "r %d", r); |
223 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanSetScanDataLReturn, MODULEUID, r); |
228 User::Leave(r); |
224 User::Leave(r); |
229 } |
225 } |
230 |
226 |
231 iScanning = ETrue; |
227 iScanning = ETrue; |
232 iEntryAttMask=anEntryAttMask; |
228 iEntryAttMask=anEntryAttMask; |
236 iAbbreviatedPath.Set(_L("\\")); |
232 iAbbreviatedPath.Set(_L("\\")); |
237 iScanDir=aScanDir; |
233 iScanDir=aScanDir; |
238 if (aScanDir==EScanDownTree) |
234 if (aScanDir==EScanDownTree) |
239 iFullPath.PopDir(); |
235 iFullPath.PopDir(); |
240 |
236 |
241 OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANSETSCANDATALRETURN2, "r %d", KErrNone); |
237 TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanSetScanDataLReturn, MODULEUID, KErrNone); |
242 } |
238 } |
243 |
239 |
244 void CDirScan::UpdateAbbreviatedPath() |
240 void CDirScan::UpdateAbbreviatedPath() |
245 // |
241 // |
246 // Set the abbreviated path based on the full path |
242 // Set the abbreviated path based on the full path |
280 @param aDirEntries On return, a pointer to an array containing filtered entries |
276 @param aDirEntries On return, a pointer to an array containing filtered entries |
281 from the next directory in the structure. NULL if there are |
277 from the next directory in the structure. NULL if there are |
282 no more directories in the structure. |
278 no more directories in the structure. |
283 */ |
279 */ |
284 { |
280 { |
285 OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANNEXTL, "this %x", this); |
281 TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanNextL, MODULEUID, this); |
286 |
282 |
287 if (iScanDir==EScanUpTree) |
283 if (iScanDir==EScanUpTree) |
288 ScanUpTreeL(aDirEntries); |
284 ScanUpTreeL(aDirEntries); |
289 else |
285 else |
290 ScanDownTreeL(aDirEntries); |
286 ScanDownTreeL(aDirEntries); |
291 |
287 |
292 OstTraceExt2(TRACE_BORDER, EFSRV_ECDIRSCANNEXTLRETURN, "r %d DirEntries %d", (TUint) KErrNone, (TUint) aDirEntries ? (*aDirEntries).Count() : 0); |
288 TRACE2(UTF::EBorder, UTraceModuleEfsrv::ECDirScanNextLReturn, MODULEUID, |
|
289 KErrNone, aDirEntries ? (*aDirEntries).Count() : 0); |
293 } |
290 } |
294 |
291 |
295 void CDirScan::ScanUpTreeL(CDir*& aDirEntries) |
292 void CDirScan::ScanUpTreeL(CDir*& aDirEntries) |
296 // |
293 // |
297 // Get the next directory starting from the bottom of the tree |
294 // Get the next directory starting from the bottom of the tree |
394 // |
391 // |
395 { |
392 { |
396 TInt r = Fs().GetDir(iFullPath.FullName(),iEntryAttMask,iEntrySortMask,aDirEntries); |
393 TInt r = Fs().GetDir(iFullPath.FullName(),iEntryAttMask,iEntrySortMask,aDirEntries); |
397 if (r != KErrNone) |
394 if (r != KErrNone) |
398 { |
395 { |
399 OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANLEAVE3, "r %d", r); |
396 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanLeave, MODULEUID, r); |
400 User::Leave(r); |
397 User::Leave(r); |
401 } |
398 } |
402 } |
399 } |
403 |
400 |
404 void CDirScan::ScanDownTreeL(CDir*& aDirEntries) |
401 void CDirScan::ScanDownTreeL(CDir*& aDirEntries) |
430 |
427 |
431 TPtrC dirName=list->Next().iName; |
428 TPtrC dirName=list->Next().iName; |
432 r=iFullPath.AddDir(dirName); |
429 r=iFullPath.AddDir(dirName); |
433 if (r==KErrGeneral) // Adding dirName makes iFullPath>256 characters |
430 if (r==KErrGeneral) // Adding dirName makes iFullPath>256 characters |
434 { |
431 { |
435 OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANLEAVE4, "r %d", KErrTooBig); |
432 TRACE1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanLeave, MODULEUID, KErrTooBig); |
436 User::Leave(KErrTooBig); |
433 User::Leave(KErrTooBig); |
437 } |
434 } |
438 |
435 |
439 // Get all valid entries in this directory |
436 // Get all valid entries in this directory |
440 |
437 |
452 r = Fs().GetDir(iFullPath.DriveAndPath(), |
449 r = Fs().GetDir(iFullPath.DriveAndPath(), |
453 KEntryAttDir|KEntryAttMatchExclusive|(iEntryAttMask&KEntryAttMatchMask), |
450 KEntryAttDir|KEntryAttMatchExclusive|(iEntryAttMask&KEntryAttMatchMask), |
454 iEntrySortMask,dirList); |
451 iEntrySortMask,dirList); |
455 if (r != KErrNone) |
452 if (r != KErrNone) |
456 { |
453 { |
457 OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANLEAVE5, "r %d", r); |
454 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanLeave, MODULEUID, r); |
458 User::Leave(r); |
455 User::Leave(r); |
459 } |
456 } |
460 iStack->PushL(*dirList); |
457 iStack->PushL(*dirList); |
461 CleanupStack::Pop(); // dirEntries |
458 CleanupStack::Pop(); // dirEntries |
462 UpdateAbbreviatedPath(); |
459 UpdateAbbreviatedPath(); |
711 { |
708 { |
712 TThreadId theId; |
709 TThreadId theId; |
713 TInt r = iFs->GetOpenFileList(iScanPos,iEntryListPos,theId,array); |
710 TInt r = iFs->GetOpenFileList(iScanPos,iEntryListPos,theId,array); |
714 if (r != KErrNone) |
711 if (r != KErrNone) |
715 { |
712 { |
716 OstTrace1(TRACE_BORDER, EFSRV_ECDIRSCANLEAVE8, "r %d", r); |
713 TRACERET1(UTF::EBorder, UTraceModuleEfsrv::ECDirScanLeave, MODULEUID, r); |
717 User::Leave(r); |
714 User::Leave(r); |
718 } |
715 } |
719 TInt count=array.Count(); |
716 TInt count=array.Count(); |
720 if (count==0) |
717 if (count==0) |
721 { |
718 { |