18 #include "cl_std.h" |
18 #include "cl_std.h" |
19 |
19 |
20 #define gPathDelimiter TChar(';') |
20 #define gPathDelimiter TChar(';') |
21 enum TMode {EFindByDrives,EFindByDrivesInPath,EFindByPath}; |
21 enum TMode {EFindByDrives,EFindByDrivesInPath,EFindByPath}; |
22 |
22 |
|
23 |
|
24 // |
|
25 // Look for aFileName in aDir |
|
26 // |
23 TInt TFindFile::DoFindInDir() |
27 TInt TFindFile::DoFindInDir() |
24 // |
28 { |
25 // Look for aFileName in aDir |
29 |
26 // |
30 if (!iDir) |
27 { |
|
28 |
|
29 if (iDir==NULL) |
|
30 { |
31 { |
31 TEntry entry; |
32 TEntry entry; |
32 TInt r=iFs->Entry(iFile.FullName(),entry); |
33 TInt r=iFs->Entry(iFile.FullName(),entry); |
33 if (r==KErrNone /*|| r==KErrAccessDenied*/) |
34 |
34 return(KErrNone); |
35 if (r != KErrNone && r != KErrNoMemory && r != KErrPermissionDenied) |
35 else if (r==KErrNoMemory) |
36 r = KErrNotFound; |
|
37 |
36 return r; |
38 return r; |
37 else if (r==KErrPermissionDenied) |
|
38 return (KErrPermissionDenied); |
|
39 else |
|
40 return(KErrNotFound); |
|
41 } |
39 } |
|
40 |
42 TInt r=iFs->GetDir(iFile.FullName(),KEntryAttMaskSupported|KEntryAttAllowUid,ESortByName,*iDir); |
41 TInt r=iFs->GetDir(iFile.FullName(),KEntryAttMaskSupported|KEntryAttAllowUid,ESortByName,*iDir); |
43 if (r==KErrNoMemory) |
42 |
44 return r; |
43 if(r == KErrNone) |
45 else if (r==KErrPermissionDenied) |
44 { |
46 return r; |
45 if(!(*iDir)->Count()) |
47 else if (r!=KErrNone) |
46 r = KErrNotFound; //-- empty directory |
48 return(KErrNotFound); |
47 } |
49 if ((*iDir)->Count()==0) |
48 else if(r != KErrNoMemory && r != KErrPermissionDenied) |
|
49 { |
|
50 r = KErrNotFound; |
|
51 } |
|
52 |
|
53 if (r != KErrNone && iDir) |
50 { |
54 { |
51 delete (*iDir); |
55 delete (*iDir); |
52 *iDir=NULL; |
56 *iDir=NULL; |
53 return(KErrNotFound); |
|
54 } |
57 } |
55 else |
58 |
56 return(KErrNone); |
59 return r; |
57 } |
60 } |
58 |
61 |
|
62 |
|
63 // |
|
64 // Look for aFileName along the path and increment aPathPos |
|
65 // |
59 TInt TFindFile::DoFindNextInPath() |
66 TInt TFindFile::DoFindNextInPath() |
60 // |
|
61 // Look for aFileName along the path and increment aPathPos |
|
62 // |
|
63 { |
67 { |
64 |
68 |
65 if (iMode==EFindByDrivesInPath) |
69 if (iMode==EFindByDrivesInPath) |
66 { |
70 { |
67 TInt r=DoFindNextInDriveList(); |
71 TInt r=DoFindNextInDriveList(); |
68 if (r==KErrNone) |
|
69 return(KErrNone); |
|
70 if (r!=KErrNotFound) |
72 if (r!=KErrNotFound) |
71 return(r); |
73 return(r); |
|
74 |
72 iMode=EFindByPath; |
75 iMode=EFindByPath; |
73 } |
76 } |
|
77 |
74 FOREVER |
78 FOREVER |
75 { |
79 { |
76 if (iPath->Length()<iPathPos) |
80 if (iPath->Length()<iPathPos) |
77 return(KErrNotFound); |
81 return(KErrNotFound); |
|
82 |
78 TPtrC path(iPath->Ptr()+iPathPos,iPath->Length()-iPathPos); |
83 TPtrC path(iPath->Ptr()+iPathPos,iPath->Length()-iPathPos); |
|
84 |
79 TInt r=path.Locate(gPathDelimiter); |
85 TInt r=path.Locate(gPathDelimiter); |
|
86 |
80 if (r==KErrNotFound) |
87 if (r==KErrNotFound) |
81 r=path.Length(); |
88 r=path.Length(); |
|
89 |
82 path.Set(path.Ptr(),r); |
90 path.Set(path.Ptr(),r); |
83 iPathPos+=r+1; |
91 iPathPos+=r+1; |
84 TFileName fileName=iFile.NameAndExt(); |
92 TFileName fileName=iFile.NameAndExt(); |
85 iFile.Set(fileName,&path,NULL); |
93 iFile.Set(fileName,&path,NULL); |
|
94 |
86 if (iFile.FullName().Length()>=2 && iFile.FullName()[1]==KDriveDelimiter) |
95 if (iFile.FullName().Length()>=2 && iFile.FullName()[1]==KDriveDelimiter) |
87 { |
96 { |
88 TInt r=DoFindInDir(); |
97 TInt r=DoFindInDir(); |
89 if (r==KErrNone) |
98 if (r == KErrNotFound) |
90 return(KErrNone); |
|
91 if (r!=KErrNotFound) |
|
92 return(r); |
|
93 continue; |
99 continue; |
|
100 |
|
101 return(r); |
94 } |
102 } |
|
103 |
95 iMode=EFindByDrivesInPath; |
104 iMode=EFindByDrivesInPath; |
96 |
105 |
97 r=FindByDir(fileName,path); |
106 r=FindByDir(fileName,path); |
98 if (r==KErrNone) |
107 |
99 return(KErrNone); |
108 if (r == KErrNotFound) |
100 if (r!=KErrNotFound) |
109 continue; |
|
110 |
101 return(r); |
111 return(r); |
102 } |
112 } |
103 |
113 |
104 } |
114 } |
105 |
115 |
|
116 |
|
117 // |
|
118 // Look for aFileName in all available drives in order |
|
119 // |
106 TInt TFindFile::DoFindNextInDriveList() |
120 TInt TFindFile::DoFindNextInDriveList() |
107 // |
|
108 // Look for aFileName in all available drives in order |
|
109 // |
|
110 { |
121 { |
111 |
122 |
112 TInt found; |
123 TInt found; |
113 TDriveInfo driveInfo; |
124 TDriveInfo driveInfo; |
114 const TUint matchedFlags= iMatchMask & KDriveAttMatchedFlags; //KDriveAttMatchedFlags = 0xFFF |
125 const TUint matchedFlags= iMatchMask & KDriveAttMatchedFlags; //KDriveAttMatchedFlags = 0xFFF |
272 return(KErrArgument); |
285 return(KErrArgument); |
273 |
286 |
274 TInt r=iFile.Set(aFileName,NULL,NULL); |
287 TInt r=iFile.Set(aFileName,NULL,NULL); |
275 if (r!=KErrNone) |
288 if (r!=KErrNone) |
276 return(r); |
289 return(r); |
|
290 |
277 iPath=aPath; |
291 iPath=aPath; |
278 iPathPos=0; |
292 iPathPos=0; |
279 iMode=EFindByPath; |
293 iMode=EFindByPath; |
280 r=DoFindInDir(); |
294 r=DoFindInDir(); |
281 |
295 |
282 |
296 // if it's not in the current dir and a search path was specified, look there. |
283 if (r==KErrNone) |
297 if (r == KErrNotFound && iPath && iPath->Length()) |
284 return(KErrNone); |
|
285 if (r!=KErrNotFound) |
|
286 return(r); |
|
287 if ((iPath==NULL) || (iPath->Length()==0)) |
|
288 return(KErrNotFound); |
|
289 |
|
290 |
|
291 r=DoFindNextInPath(); |
298 r=DoFindNextInPath(); |
|
299 |
292 return(r); |
300 return(r); |
293 } |
301 } |
294 |
302 |
295 TInt TFindFile::DoFindByDir(const TDesC& aFileName,const TDesC& aDir) |
303 |
296 // |
304 // |
297 // Look for aFileName in aDir on each connected drive |
305 // Look for aFileName in aDir on each connected drive |
298 // Make initial check for aFileName in aDir on current drive |
306 // Make initial check for aFileName in aDir on current drive |
299 // |
307 // |
|
308 TInt TFindFile::DoFindByDir(const TDesC& aFileName,const TDesC& aDir) |
300 { |
309 { |
301 |
310 |
302 if (aFileName.Length() <= 0) |
311 if (aFileName.Length() <= 0) |
303 return(KErrArgument); |
312 return(KErrArgument); |
304 |
313 |
305 TInt r=iFs->Parse(aFileName,aDir,iFile); |
314 TInt r=iFs->Parse(aFileName,aDir,iFile); |
306 if (r!=KErrNone) |
315 if (r!=KErrNone) |
307 return(r); |
316 return(r); |
|
317 |
308 TInt searchResult=DoFindInDir(); |
318 TInt searchResult=DoFindInDir(); |
309 if(searchResult==KErrNoMemory) |
319 if(searchResult == KErrNoMemory || searchResult == KErrPermissionDenied) |
310 return(searchResult); |
320 return(searchResult); |
311 |
|
312 if(searchResult==KErrPermissionDenied) |
|
313 return (KErrPermissionDenied); |
|
314 |
321 |
315 r=iFs->DriveList(iDrvList,KDriveAttAll); |
322 r=iFs->DriveList(iDrvList,KDriveAttAll); |
316 if (r!=KErrNone) |
323 if (r!=KErrNone) |
317 return(r); |
324 return(r); |
|
325 |
318 TInt drive; |
326 TInt drive; |
319 r=RFs::CharToDrive(iFile.Drive()[0],drive); |
327 r=RFs::CharToDrive(iFile.Drive()[0],drive); |
320 if (r!=KErrNone) |
328 if (r!=KErrNone) |
321 return(r); |
329 return(r); |
|
330 |
322 iDrvList[drive]=0; // Drive 'drive' has already been searched |
331 iDrvList[drive]=0; // Drive 'drive' has already been searched |
323 iCurrentDrive=EDriveY; |
332 iCurrentDrive=EDriveY; |
324 iMode=EFindByDrives; |
333 iMode=EFindByDrives; |
|
334 |
325 if (searchResult==KErrNone) |
335 if (searchResult==KErrNone) |
326 return(KErrNone); |
336 return(KErrNone); |
327 |
337 |
328 |
338 |
329 return(DoFindNextInDriveList()); |
339 return(DoFindNextInDriveList()); |
330 } |
340 } |
331 |
341 |
332 |
342 /** |
333 |
343 internal helper method that deletes the (*iDir) object in the case of errors and assigns NULL to the client's pointer top it. |
334 |
344 */ |
335 EXPORT_C TInt TFindFile::FindByPath(const TDesC& aFileName,const TDesC* aPath) |
345 TInt TFindFile::CallSafe(TInt aResult) |
|
346 { |
|
347 if (aResult != KErrNone && iDir) |
|
348 { |
|
349 delete *iDir; |
|
350 *iDir = NULL; |
|
351 iDir = NULL; |
|
352 } |
|
353 return aResult; |
|
354 } |
|
355 |
|
356 |
336 /** |
357 /** |
337 Searches for a file/directory in one or more directories in the path. |
358 Searches for a file/directory in one or more directories in the path. |
338 |
359 |
339 The search ends when the file/directory is found, or when every directory |
360 The search ends when the file/directory is found, or when every directory |
340 specified in the path list has been unsuccessfully searched. |
361 specified in the path list has been unsuccessfully searched. |
414 @see TFindFile::FindWildByDir() |
435 @see TFindFile::FindWildByDir() |
415 @see TFindFile::File() |
436 @see TFindFile::File() |
416 @see TFindFile::Find() |
437 @see TFindFile::Find() |
417 @see TFindFile::SetFindMask() |
438 @see TFindFile::SetFindMask() |
418 */ |
439 */ |
|
440 EXPORT_C TInt TFindFile::FindByDir(const TDesC& aFileName,const TDesC& aDir) |
419 { |
441 { |
420 |
442 |
421 iDir=NULL; |
443 iDir=NULL; |
422 return(DoFindByDir(aFileName,aDir)); |
444 return CallSafe(DoFindByDir(aFileName,aDir)); |
423 } |
445 } |
424 |
446 |
425 |
447 |
426 |
448 |
427 |
449 |
428 EXPORT_C TInt TFindFile::FindWildByPath(const TDesC& aFileName,const TDesC* aPath,CDir*& aDir) |
450 |
429 /** |
451 /** |
430 Searches for one or more files/directories in the directories contained in a |
452 Searches for one or more files/directories in the directories contained in a path list. |
431 path list. |
453 |
432 |
454 Wildcard characters can be specified. The search ends when one or more filenames matching aFileName is found, or when every |
433 Wildcard characters can be specified. The search ends when one or more |
455 directory in the path list has been unsuccessfully searched. To begin searching again after a successful match has been made, use FindWild(). |
434 filenames matching aFileName is found, or when every |
456 |
435 directory in the path list has been unsuccessfully searched. |
457 Using function SetFindMask it is possible to specify a combination of attributes that the drives to be searched must match. |
436 To begin searching again after a successful match has been made, |
|
437 use FindWild(). |
|
438 |
|
439 Using function SetFindMask it is possible to specify a combination of |
|
440 attributes that the drives to be searched must match. |
|
441 |
458 |
442 Notes: |
459 Notes: |
443 |
460 |
444 1. The caller of the function is responsible for deleting |
461 1. The function sets aDir to NULL, then allocates memory for it before appending entries to the list. Therefore, |
445 aDir after the function has returned. |
462 aDir should have no memory allocated to it before this function is called, otherwise this memory will become orphaned. |
446 |
463 |
447 2. Calling TFindFile::File() after a successful search gets the drive letter |
464 2. The caller of the function is responsible for deleting aDir after the function has returned. On error this pointer will be set NULL, |
448 and directory containing the file(s). The filenames can be retrieved via |
465 thus safe to delete. |
449 the array of TEntry::iName objects contained in aDir. If you want to |
466 |
450 retrieve the fully qualified path of a file, you need to parse the path and |
467 3. Calling TFindFile::File() after a successful search gets the drive letter and directory containing the file(s). |
451 the filename. |
468 The filenames can be retrieved via the array of TEntry::iName objects contained in aDir. If you want to retrieve the fully |
|
469 qualified path of a file, you need to parse the path and the filename. |
452 |
470 |
453 @param aFileName The filename to search for. May contain wildcards. If |
471 @param aFileName The filename to search for. May contain wildcards. If it specifies a directory as well as a filename, then that |
454 it specifies a directory as well as a filename, then that |
|
455 directory is searched first. |
472 directory is searched first. |
456 @param aPath List of directories to search. Paths in this list must be |
473 |
457 separated by a semicolon character, but a semicolon is not |
474 @param aPath List of directories to search. Paths in this list must be separated by a semicolon character, but a semicolon is not |
458 required after the final path. The directories are searched |
475 required after the final path. The directories are searched in the order in which they occur in the list. |
459 in the order in which they occur in the list. |
476 Directories must be fully qualified, including a drive letter, and the name must end with a backslash. |
460 Directories must be fully qualified, including |
477 |
461 a drive letter, and the name must end with a backslash. |
478 @param aDir in: a reference to the pointer that will be modified by this method. |
462 @param aDir On return, contains the entries for all files matching |
479 |
463 aFileName in the first directory in which a match occurred. |
480 out: On success a pointer to the internally allocated by this method CDir object, which in turn contains the entries for |
|
481 all files matching aFileName in the first directory in which a match occurred. In this case this API caller is responsible |
|
482 for deleting aDir. |
|
483 If some error occured (including KErrNotFound meaning that nothing found) this pointer will be set to NULL, which is also safe to delete. |
464 |
484 |
465 @return KErrNone, if one or more matching files was found; |
485 @return KErrNone, if one or more matching files was found; |
466 KErrNotFound, if no matching file was found in any of the directories. |
486 KErrNotFound, if no matching file was found in any of the directories. |
467 KErrArgument, if the filename is empty. |
487 KErrArgument, if the filename is empty. |
468 |
488 |
469 @see TFindFile::FindWild |
489 @see TFindFile::FindWild |
470 @see TFindFile::File |
490 @see TFindFile::File |
471 @see TEntry::iName |
491 @see TEntry::iName |
472 @see TFindFile::SetFindMask() |
492 @see TFindFile::SetFindMask() |
473 */ |
493 */ |
|
494 EXPORT_C TInt TFindFile::FindWildByPath(const TDesC& aFileName,const TDesC* aPath,CDir*& aDir) |
474 { |
495 { |
475 |
496 |
476 iDir=&aDir; |
497 iDir=&aDir; |
477 return(DoFindByPath(aFileName,aPath)); |
498 *iDir=NULL; |
478 } |
499 |
479 |
500 return CallSafe(DoFindByPath(aFileName,aPath)); |
480 |
501 } |
481 |
502 |
482 |
503 |
483 EXPORT_C TInt TFindFile::FindWildByDir(const TDesC& aFileName,const TDesC& aDirPath,CDir*& aDir) |
504 |
484 /** |
505 |
485 Searches, using wildcards, for one or more files/directories in a specified |
506 |
486 directory. |
507 /** |
487 |
508 Searches, using wildcards, for one or more files/directories in a specified directory. |
488 If no matching file is found in that directory, all available drives are |
509 |
489 searched in descending alphabetical order, from Y: to A:, and ending |
510 If no matching file is found in that directory, all available drives are searched in descending alphabetical order, from Y: to A:, and ending |
490 with the Z: drive.Using function SetFindMask it is possible to specify a |
511 with the Z: drive.Using function SetFindMask it is possible to specify a combination of attributes that the drives to be searched must match. |
491 combination of attributes that the drives to be searched must match. |
512 |
492 |
513 The search ends when one or more matching filenames are found, or when every available drive has been unsuccessfully searched. |
493 The search ends when one or more matching filenames are found, or when every |
514 To begin searching again after a successful match has been made, use FindWild(). Wildcards may be specified in the filename. |
494 available drive has been unsuccessfully searched. To begin searching again |
|
495 after a successful match has been made, use FindWild(). Wildcards may be |
|
496 specified in the filename. |
|
497 |
515 |
498 Notes: |
516 Notes: |
499 |
517 |
500 1. A drive letter may be specified in aDirPath (or in aFileName). If a drive |
518 1. A drive letter may be specified in aDirPath (or in aFileName). If a drive is specified, that drive is searched first, |
501 is specified, that drive is searched first, followed by the other available |
519 followed by the other available drives, in descending alphabetical order. If no drive is specified, the drive contained in the session |
502 drives, in descending alphabetical order. If no drive is specified, the drive |
520 path is searched first. |
503 contained in the session path is searched first. |
521 |
504 |
522 2. The function sets aDir to NULL, then allocates memory for it before appending entries to the list. Therefore, |
505 2. The function sets aDir to NULL, then allocates memory for it before appending |
523 aDir should have no memory allocated to it before this function is called, otherwise this memory will become orphaned. |
506 entries to the list. Therefore, aDir should have no memory allocated to it |
524 |
507 before this function is called, otherwise this memory will become orphaned. |
525 3. The caller of the function is responsible for deleting aDir after the function has returned. On error this pointer will be set NULL, |
508 |
526 thus safe to delete. |
509 3. The caller of this function is responsible for deleting aDir after the function |
527 |
510 has returned. |
528 |
511 |
529 4. Calling TFindFile::File() after a successful search returns the drive letter and directory containing the file(s). |
512 4. Calling TFindFile::File() after a successful search returns the drive letter |
530 Filenames may be retrieved via the array of TEntry::iNames contained in aDir. If you want to retrieve the fully |
513 and directory containing the file(s). Filenames may be retrieved via the array |
|
514 of TEntry::iNames contained in aDir. If you want to retrieve the fully |
|
515 qualified path of a file, you will need to parse the path and the filename. |
531 qualified path of a file, you will need to parse the path and the filename. |
516 |
532 |
517 @param aFileName The filename to search for. May contain wildcards. If a path |
533 @param aFileName The filename to search for. May contain wildcards. If a path is specified, it overrides the path specified in aDirPath. |
518 is specified, it overrides the path specified in aDirPath. |
534 If no path is specified, the path contained in aDirPath is used in the search. |
519 If no path is specified, the path contained in aDirPath is |
535 |
520 used in the search. |
|
521 @param aDirPath Path indicating a directory to search on each drive. |
536 @param aDirPath Path indicating a directory to search on each drive. |
522 @param aDir On return, contains the entries for all files |
537 |
523 matching aFileName. |
538 @param aDir in: a reference to the pointer that will be modified by this method. |
|
539 |
|
540 out: On success a pointer to the internally allocated by this method CDir object, which in turn contains the entries for |
|
541 all files matching aFileName in the first directory in which a match occurred. In this case this API caller is responsible |
|
542 for deleting aDir. |
|
543 If some error occured (including KErrNotFound meaning that nothing found) this pointer will be set to NULL, which is also safe to delete. |
524 |
544 |
525 @return KErrNone if one or more matching files was found; |
545 @return KErrNone if one or more matching files was found; |
526 KErrNotFound if no matching file was found in the directory on any |
546 KErrNotFound if no matching file was found in the directory on any of the drives. |
527 of the drives. |
|
528 KErrArgument, if the filename is empty. |
547 KErrArgument, if the filename is empty. |
529 |
548 |
530 @see TFindFile::FindWild |
549 @see TFindFile::FindWild |
531 @see TFindFile::File |
550 @see TFindFile::File |
532 @see TFindFile::SetFindMask() |
551 @see TFindFile::SetFindMask() |
533 */ |
552 */ |
534 { |
553 EXPORT_C TInt TFindFile::FindWildByDir(const TDesC& aFileName,const TDesC& aDirPath,CDir*& aDir) |
535 |
554 { |
536 iDir=&aDir; |
555 iDir=&aDir; |
537 return(DoFindByDir(aFileName,aDirPath)); |
556 *iDir=NULL; |
538 } |
557 |
539 |
558 return CallSafe(DoFindByDir(aFileName,aDirPath)); |
540 |
559 } |
541 |
560 |
542 |
561 |
|
562 |
|
563 |
|
564 // |
|
565 // Find the next match |
|
566 // |
543 TInt TFindFile::DoFind() |
567 TInt TFindFile::DoFind() |
544 // |
|
545 // Find the next match |
|
546 // |
|
547 { |
568 { |
548 |
569 |
549 TInt ret=KErrNone; |
570 TInt ret=KErrNone; |
550 switch(iMode) |
571 switch(iMode) |
551 { |
572 { |
587 @see TFindFile::FindByDir |
608 @see TFindFile::FindByDir |
588 @see TFindFile::File |
609 @see TFindFile::File |
589 @see TFindFile::SetFindMask() |
610 @see TFindFile::SetFindMask() |
590 |
611 |
591 */ |
612 */ |
|
613 EXPORT_C TInt TFindFile::Find() |
592 { |
614 { |
593 |
615 |
594 // iDir=NULL; |
616 // iDir=NULL; |
595 return(DoFind()); |
617 return(DoFind()); |
596 } |
618 } |
597 |
619 |
598 |
620 |
599 |
621 |
600 |
622 |
601 EXPORT_C TInt TFindFile::FindWild(CDir*& aDir) |
623 |
602 /** |
624 /** |
603 Searches for the next file/directory. |
625 Searches for the next file/directory. |
604 |
626 |
605 This should be used after a successful call to FindWildByPath() |
627 This should be used after a successful call to FindWildByPath() |
606 or FindWildByDir(), for the next occurrences of the filename in the |
628 or FindWildByDir(), for the next occurrences of the filename in the |
607 path or drive list.Using function SetFindMask it is possible to specify a |
629 path or drive list.Using function SetFindMask it is possible to specify a |
608 combination of attributes that the drives to be searched must match. |
630 combination of attributes that the drives to be searched must match. |
609 |
631 |
610 Notes: |
632 Notes: |
611 |
633 |
612 1. The caller of this function is responsible for deleting aDir after |
634 1. The function sets aDir to NULL, then allocates memory for it before appending entries to the list. Therefore, |
613 the function has returned |
635 aDir should have no memory allocated to it before this function is called, otherwise this memory will become orphaned. |
614 |
636 |
615 2. Calling TFindFile::File() after a successful search, will return |
637 2. The caller of the function is responsible for deleting aDir after the function has returned. On error this pointer will be set NULL, |
616 the drive letter and the directory containing the file(s). |
638 thus safe to delete. |
617 The filenames may be retrieved via the array of TEntry::iName objects |
639 |
618 contained in aDir. If you want to retrieve the fully qualified |
640 3. Calling TFindFile::File() after a successful search, will return the drive letter and the directory containing the file(s). |
619 path of a file, you will need to parse the path and the filename using |
641 The filenames may be retrieved via the array of TEntry::iName objects contained in aDir. If you want to retrieve the fully qualified |
620 the TParse class or derived classes. |
642 path of a file, you will need to parse the path and the filename using the TParse class or derived classes. |
621 |
643 |
622 @param aDir On return, contains the entries for all matching files found in |
644 @param aDir in: a reference to the pointer that will be modified by this method. |
623 the next directory. |
645 |
|
646 out: On success a pointer to the internally allocated by this method CDir object, which in turn contains the entries for |
|
647 all files matching aFileName in the first directory in which a match occurred. In this case this API caller is responsible |
|
648 for deleting aDir. |
|
649 If some error occured (including KErrNotFound meaning that nothing found) this pointer will be set to NULL, which is also safe to delete. |
624 |
650 |
625 @return KErrNone, if further occurrences were found; |
651 @return KErrNone if further occurrences were found; |
626 KErrNotFound, if no more matching files were found. |
652 KErrNotFound if no more matching files were found. |
627 |
653 |
628 |
654 |
629 @see TParse |
655 @see TParse |
630 @see TEntry::iName |
656 @see TEntry::iName |
631 @see TFindFile::File |
657 @see TFindFile::File |
632 @see TFindFile::FindWildByPath |
658 @see TFindFile::FindWildByPath |
633 @see TFindFile::FindWildByDir |
659 @see TFindFile::FindWildByDir |
634 @see TFindFile::SetFindMask() |
660 @see TFindFile::SetFindMask() |
635 */ |
661 */ |
|
662 EXPORT_C TInt TFindFile::FindWild(CDir*& aDir) |
636 { |
663 { |
637 |
664 |
638 iDir=&aDir; |
665 iDir=&aDir; |
639 return(DoFind()); |
666 *iDir=NULL; |
640 } |
667 |
641 |
668 return CallSafe(DoFind()); |
642 |
669 } |
643 |
670 |
644 EXPORT_C TInt TFindFile::SetFindMask(TUint aMask) |
671 |
|
672 |
|
673 |
645 /** |
674 /** |
646 Can be used in order to specify a combination of drive attributes that the drives |
675 Can be used in order to specify a combination of drive attributes that the drives |
647 to be searched must match. When searching without specifying a mask, all drives, except the |
676 to be searched must match. When searching without specifying a mask, all drives, except the |
648 remote ones will be returned. |
677 remote ones will be returned. |
649 |
678 |