1942 } |
1942 } |
1943 } |
1943 } |
1944 } |
1944 } |
1945 |
1945 |
1946 // ----------------------------------------------------------------------------- |
1946 // ----------------------------------------------------------------------------- |
|
1947 // hspsServerUtil::FindFilesRecursivelyL |
|
1948 // ----------------------------------------------------------------------------- |
|
1949 void hspsServerUtil::FindFilesRecursivelyL( |
|
1950 RFs& aFs, |
|
1951 const RArray<TInt>& aDriveArray, |
|
1952 const TDesC& aPath, |
|
1953 RPointerArray<HBufC>& aFolders, |
|
1954 TBool aRecursive ) |
|
1955 { |
|
1956 TParsePtrC parser( aPath ); |
|
1957 |
|
1958 TFindFile fileFinder( aFs ); |
|
1959 fileFinder.SetFindMask( KDriveAttExclude|KDriveAttRemovable|KDriveAttRemote|KDriveAttSubsted ); |
|
1960 |
|
1961 _LIT(KMaskFile, "*"); |
|
1962 for( TInt driveIndex=0; driveIndex < aDriveArray.Count(); driveIndex++ ) |
|
1963 { |
|
1964 TChar driveChar; |
|
1965 User::LeaveIfError( RFs::DriveToChar( aDriveArray[driveIndex], driveChar ) ); |
|
1966 TBuf16<2> driveBuf(2); |
|
1967 driveBuf[0] = TUint( driveChar ); |
|
1968 driveBuf[1] = TUint( TChar(':') ); |
|
1969 |
|
1970 TPath path; |
|
1971 path.Copy( driveBuf ); |
|
1972 path.Append( parser.Path() ); |
|
1973 |
|
1974 CDir* dirList( NULL ); |
|
1975 fileFinder.FindWildByDir( KMaskFile, path, dirList ); |
|
1976 if ( dirList ) |
|
1977 { |
|
1978 CleanupStack::PushL( dirList ); |
|
1979 |
|
1980 const TInt count = dirList->Count(); |
|
1981 for( TInt entryIndex = 0; entryIndex < count; entryIndex++ ) |
|
1982 { |
|
1983 const TEntry& entry = (*dirList)[ entryIndex ]; |
|
1984 |
|
1985 TFileName file( path ); |
|
1986 file.Append( entry.iName ); |
|
1987 if( entry.IsDir() ) |
|
1988 { |
|
1989 file.Append( KDoubleBackSlash ); |
|
1990 } |
|
1991 |
|
1992 if( !BaflUtils::FileExists( aFs, file ) ) |
|
1993 { |
|
1994 continue; |
|
1995 } |
|
1996 if( entry.IsDir() && aRecursive ) |
|
1997 { |
|
1998 FindFilesRecursivelyL( aFs, aDriveArray, file, aFolders ); |
|
1999 } |
|
2000 else |
|
2001 { |
|
2002 HBufC* nameBuf = file.AllocLC(); |
|
2003 aFolders.AppendL( nameBuf ); |
|
2004 CleanupStack::Pop( nameBuf ); |
|
2005 } |
|
2006 } |
|
2007 |
|
2008 CleanupStack::PopAndDestroy( dirList ); |
|
2009 dirList = 0; |
|
2010 } // dirlist |
|
2011 |
|
2012 } // driveIndex |
|
2013 } |
|
2014 |
|
2015 |
|
2016 // ----------------------------------------------------------------------------- |
1947 // hspsServerUtil::hspsServerUtil |
2017 // hspsServerUtil::hspsServerUtil |
1948 // ----------------------------------------------------------------------------- |
2018 // ----------------------------------------------------------------------------- |
1949 // |
2019 // |
1950 hspsServerUtil::hspsServerUtil() |
2020 hspsServerUtil::hspsServerUtil() |
1951 { |
2021 { |