diff -r 15e4dd19031c -r a0713522ab97 homescreenpluginsrv/hspsmanager/src/hspsserverutil.cpp --- a/homescreenpluginsrv/hspsmanager/src/hspsserverutil.cpp Wed Mar 31 22:04:35 2010 +0300 +++ b/homescreenpluginsrv/hspsmanager/src/hspsserverutil.cpp Wed Apr 14 16:16:44 2010 +0300 @@ -1944,6 +1944,76 @@ } // ----------------------------------------------------------------------------- +// hspsServerUtil::FindFilesRecursivelyL +// ----------------------------------------------------------------------------- +void hspsServerUtil::FindFilesRecursivelyL( + RFs& aFs, + const RArray& aDriveArray, + const TDesC& aPath, + RPointerArray& aFolders, + TBool aRecursive ) + { + TParsePtrC parser( aPath ); + + TFindFile fileFinder( aFs ); + fileFinder.SetFindMask( KDriveAttExclude|KDriveAttRemovable|KDriveAttRemote|KDriveAttSubsted ); + + _LIT(KMaskFile, "*"); + for( TInt driveIndex=0; driveIndex < aDriveArray.Count(); driveIndex++ ) + { + TChar driveChar; + User::LeaveIfError( RFs::DriveToChar( aDriveArray[driveIndex], driveChar ) ); + TBuf16<2> driveBuf(2); + driveBuf[0] = TUint( driveChar ); + driveBuf[1] = TUint( TChar(':') ); + + TPath path; + path.Copy( driveBuf ); + path.Append( parser.Path() ); + + CDir* dirList( NULL ); + fileFinder.FindWildByDir( KMaskFile, path, dirList ); + if ( dirList ) + { + CleanupStack::PushL( dirList ); + + const TInt count = dirList->Count(); + for( TInt entryIndex = 0; entryIndex < count; entryIndex++ ) + { + const TEntry& entry = (*dirList)[ entryIndex ]; + + TFileName file( path ); + file.Append( entry.iName ); + if( entry.IsDir() ) + { + file.Append( KDoubleBackSlash ); + } + + if( !BaflUtils::FileExists( aFs, file ) ) + { + continue; + } + if( entry.IsDir() && aRecursive ) + { + FindFilesRecursivelyL( aFs, aDriveArray, file, aFolders ); + } + else + { + HBufC* nameBuf = file.AllocLC(); + aFolders.AppendL( nameBuf ); + CleanupStack::Pop( nameBuf ); + } + } + + CleanupStack::PopAndDestroy( dirList ); + dirList = 0; + } // dirlist + + } // driveIndex + } + + +// ----------------------------------------------------------------------------- // hspsServerUtil::hspsServerUtil // ----------------------------------------------------------------------------- //