mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp
branchRCL_3
changeset 48 debf68073f2f
parent 40 453dfc402455
child 58 142dacf7b30e
equal deleted inserted replaced
45:74aa6861c87d 48:debf68073f2f
   414     TUint32 handle( KMTPHandleNoParent );
   414     TUint32 handle( KMTPHandleNoParent );
   415     TInt pos( KErrNotFound );
   415     TInt pos( KErrNotFound );
   416     TInt lengthOfRight( folderRight.Length());
   416     TInt lengthOfRight( folderRight.Length());
   417     TFileName folderLeft;
   417     TFileName folderLeft;
   418     
   418     
   419     _LIT( KRootFolder, "?:\\");
   419     // get root path of storage
       
   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:
   420     
   427     
   421     /*
   428     /*
   422     Go through from beginning.
   429     Go through from beginning.
   423     when this while end, folderLeft keeps the top
   430     when this while end, folderLeft keeps the top
   424     layer folder which has no handle
   431     layer folder which has no handle
   432             }
   439             }
   433         folderLeft.Append( folderRight.Left( pos + 1 ));
   440         folderLeft.Append( folderRight.Left( pos + 1 ));
   434         lengthOfRight = folderRight.Length()-pos -1;
   441         lengthOfRight = folderRight.Length()-pos -1;
   435         folderRight.Set( folderRight.Right( lengthOfRight ));
   442         folderRight.Set( folderRight.Right( lengthOfRight ));
   436         
   443         
   437         if ( KErrNotFound != folderLeft.Match( KRootFolder ))
   444         if ( rootDirPath.FindF(folderLeft) != KErrNotFound)
   438         	{
   445         	{
   439         	//first time, root folder
   446         	//first time, root folder
   440         	//continue
   447         	//continue
   441         	continue;
   448         	continue;
   442         	}
   449         	}
   443         parentHandle = handle;
   450         parentHandle = handle;
   444         handle = Framework().ObjectMgr().HandleL( folderLeft );
   451         handle = Framework().ObjectMgr().HandleL( folderLeft );
   445         }
   452         }
   446     while( KMTPHandleNone != handle );
   453     while( KMTPHandleNone != handle );
   447     
   454     CleanupStack::PopAndDestroy(&rootDirPath);
   448 
   455 
   449     if ( KMTPHandleNone == handle )
   456     if ( KMTPHandleNone == handle )
   450         {
   457         {
   451         __FLOG(_L8("need to add entry into mtp database"));
   458         __FLOG(_L8("need to add entry into mtp database"));
   452         
   459