mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp
branchRCL_3
changeset 58 142dacf7b30e
parent 48 debf68073f2f
equal deleted inserted replaced
48:debf68073f2f 58:142dacf7b30e
   386 		CDevDpExtnPluginMap* extnpluginMap = NULL;
   386 		CDevDpExtnPluginMap* extnpluginMap = NULL;
   387 		extnpluginMap = CDevDpExtnPluginMap::NewL(*this, TUid::Uid(extnUidArray[i]));
   387 		extnpluginMap = CDevDpExtnPluginMap::NewL(*this, TUid::Uid(extnUidArray[i]));
   388 
   388 
   389 		if(extnpluginMap )
   389 		if(extnpluginMap )
   390 			{
   390 			{
   391             CleanupStack::PushL(extnpluginMap);
       
   392 			iExtnPluginMapArray.AppendL(extnpluginMap);
   391 			iExtnPluginMapArray.AppendL(extnpluginMap);
   393 			CleanupStack::Pop(extnpluginMap);
       
   394 			}
   392 			}
   395 
   393 
   396 		}
   394 		}
   397 	CleanupStack::PopAndDestroy(&extnUidArray);
   395 	CleanupStack::PopAndDestroy(&extnUidArray);
   398 	}
   396 	}
   414     TUint32 handle( KMTPHandleNoParent );
   412     TUint32 handle( KMTPHandleNoParent );
   415     TInt pos( KErrNotFound );
   413     TInt pos( KErrNotFound );
   416     TInt lengthOfRight( folderRight.Length());
   414     TInt lengthOfRight( folderRight.Length());
   417     TFileName folderLeft;
   415     TFileName folderLeft;
   418     
   416     
   419     // get root path of storage
   417     _LIT( KRootFolder, "?:\\");
   420     TInt driveNumber;
       
   421     User::LeaveIfError(Framework().Fs().CharToDrive(folderRight[0], driveNumber));
       
   422     RBuf rootDirPath;
       
   423     rootDirPath.CreateL(KMaxFileName);
       
   424     rootDirPath.CleanupClosePushL();
       
   425     iDevDpSingletons.ConfigMgr().GetRootDirPathL(driveNumber, rootDirPath);
       
   426     rootDirPath.Insert(0, folderRight.Mid(0, 2));// get drive:
       
   427     
   418     
   428     /*
   419     /*
   429     Go through from beginning.
   420     Go through from beginning.
   430     when this while end, folderLeft keeps the top
   421     when this while end, folderLeft keeps the top
   431     layer folder which has no handle
   422     layer folder which has no handle
   439             }
   430             }
   440         folderLeft.Append( folderRight.Left( pos + 1 ));
   431         folderLeft.Append( folderRight.Left( pos + 1 ));
   441         lengthOfRight = folderRight.Length()-pos -1;
   432         lengthOfRight = folderRight.Length()-pos -1;
   442         folderRight.Set( folderRight.Right( lengthOfRight ));
   433         folderRight.Set( folderRight.Right( lengthOfRight ));
   443         
   434         
   444         if ( rootDirPath.FindF(folderLeft) != KErrNotFound)
   435         if ( KErrNotFound != folderLeft.Match( KRootFolder ))
   445         	{
   436         	{
   446         	//first time, root folder
   437         	//first time, root folder
   447         	//continue
   438         	//continue
   448         	continue;
   439         	continue;
   449         	}
   440         	}
   450         parentHandle = handle;
   441         parentHandle = handle;
   451         handle = Framework().ObjectMgr().HandleL( folderLeft );
   442         handle = Framework().ObjectMgr().HandleL( folderLeft );
   452         }
   443         }
   453     while( KMTPHandleNone != handle );
   444     while( KMTPHandleNone != handle );
   454     CleanupStack::PopAndDestroy(&rootDirPath);
   445     
   455 
   446 
   456     if ( KMTPHandleNone == handle )
   447     if ( KMTPHandleNone == handle )
   457         {
   448         {
   458         __FLOG(_L8("need to add entry into mtp database"));
   449         __FLOG(_L8("need to add entry into mtp database"));
   459         
   450