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