harvester/monitorplugins/mmcplugin/src/mmcfilelist.cpp
changeset 1 acef663c1218
parent 0 c53acadfccc6
child 2 b73a2e62868f
--- a/harvester/monitorplugins/mmcplugin/src/mmcfilelist.cpp	Mon Jan 18 20:34:07 2010 +0200
+++ b/harvester/monitorplugins/mmcplugin/src/mmcfilelist.cpp	Tue Jan 26 12:13:20 2010 +0200
@@ -52,6 +52,7 @@
 	{
 	iHem = CHarvesterEventManager::GetInstanceL();
 	iMediaIdUtil = &RMediaIdUtil::GetInstanceL();
+	CHarvesterCenRepUtil::GetIgnorePathL( iIgnorePaths );
 	}
 
 CMmcFileList::~CMmcFileList()
@@ -61,6 +62,8 @@
 		iHem->ReleaseInstance();
 		}
 	RMediaIdUtil::ReleaseInstance();
+	iIgnorePaths.ResetAndDestroy();
+	iIgnorePaths.Close();
 	}
 
 TBool CMmcFileList::IsDescInArray(const TPtrC& aSearch, const RPointerArray<HBufC>& aArray)
@@ -96,18 +99,22 @@
 	
 	WRITELOG1( "CMmcFileList::BuildFileListL - mediaId: %d", mediaId );
 	
-	RPointerArray<HBufC> ignorePaths;
-	TCleanupItem cleanupItem( MdsUtils::CleanupPtrArray<HBufC>, &ignorePaths );
-    CleanupStack::PushL( cleanupItem );
-    
-    CHarvesterCenRepUtil::GetIgnorePathL( ignorePaths );
-	
     CDir* directory = NULL;
     TFileName name; 
+    TBool rootDir( ETrue );
     
 	while ( path->Count() > 0 )
 		{
-		TInt error = aFs.GetDir( (*path)[0], KEntryAttDir, KHarvesterGetDirFlags, directory );
+		TInt error( KErrNone );
+		if( rootDir )
+		    {
+		    error = aFs.GetDir( (*path)[0], KEntryAttDir, KHarvesterGetRootDirFlags, directory );
+		    rootDir = EFalse;
+		    }
+		else
+		    {
+		    error = aFs.GetDir( (*path)[0], KEntryAttDir, KHarvesterGetDirFlags, directory );
+		    }
 		if ( error == KErrNone )
 			{
 			for ( TInt i=0; i < directory->Count(); ++i )
@@ -127,8 +134,8 @@
 			
 				if ( entry.IsDir() )
 					{
-					// If path is too long, skip it as the file cannot be supported
-	                if( name.Length() >= KMaxPath )
+					// If path is too long with backslash, skip it as the file cannot be supported
+	                if( name.Length() + 1 >= KMaxPath )
 	                    {
 	                    continue;
 	                    }
@@ -140,7 +147,7 @@
 					// remove drive letter and colon from path
 					TPtrC pathOnly = name.Mid( 2 );
 					
-					if ( IsDescInArray( pathOnly, ignorePaths ) )
+					if ( IsDescInArray( pathOnly, iIgnorePaths ) )
 						{
 						continue;
 						}
@@ -171,8 +178,6 @@
 		directory = NULL;
 		}
 	
-	CleanupStack::PopAndDestroy( &ignorePaths );
-	
 	CleanupStack::PopAndDestroy( path );
 	
 	WRITELOG( "CMmcFileList::BuildFileListL - end" );