mmplugins/lib3gp/impl/src/file.cpp
branchRCL_3
changeset 40 f429a0a2075b
parent 39 3f0ddfac3ede
child 49 735348f59235
equal deleted inserted replaced
39:3f0ddfac3ede 40:f429a0a2075b
  1386   PRINT(_L("3GPLib::initMetaDataFiles() in"));
  1386   PRINT(_L("3GPLib::initMetaDataFiles() in"));
  1387   TFileName filename;
  1387   TFileName filename;
  1388   TFileName path;
  1388   TFileName path;
  1389   TInt error;
  1389   TInt error;
  1390 
  1390 
  1391   // Create a directory for the files
  1391   TDriveList driveList;
  1392   if ( handle->fileName )
  1392   TBool pathSet = EFalse;
  1393     {
  1393   
  1394     filename = (TText *)handle->fileName;
  1394   // As ram drive access is faster, try to set temp file directory to available ram drive.
       
  1395   if (((RFs *)(handle->fs))->DriveList(driveList) == KErrNone)
       
  1396 	{
       
  1397 	for ( TInt i = 0; i < driveList.Length(); i++ )
       
  1398 		{
       
  1399 		TDriveInfo driveInfo;
       
  1400 		if (((RFs *)(handle->fs))->Drive(driveInfo, i) == KErrNone)
       
  1401 			{
       
  1402 			if (driveInfo.iType == EMediaRam)
       
  1403 				{
       
  1404 				TChar driveLetter;
       
  1405 				((RFs *)(handle->fs))->DriveToChar(i, driveLetter);
       
  1406 				path.Append(driveLetter);
       
  1407 				path.Append(_L(":"));
       
  1408 				path.Append(KTmpDirectoryName);
       
  1409 				pathSet = ETrue;
       
  1410 				break;
       
  1411 				}
       
  1412 			}
       
  1413 		}
       
  1414 	}
       
  1415 	  
       
  1416   // If no ram drive was found create a directory for the files on current drive
       
  1417   if (!pathSet)
       
  1418 	{
       
  1419 	if ( handle->fileName )
       
  1420 		{
       
  1421 		filename = (TText *)handle->fileName;
  1395     
  1422     
  1396     TParse fp;
  1423 		TParse fp;
  1397     path = KTmpDirectoryName;
  1424 		path = KTmpDirectoryName;
  1398     if (((RFs *)(handle->fs))->Parse(filename, fp) != KErrNone)
  1425 		if (((RFs *)(handle->fs))->Parse(filename, fp) != KErrNone)
  1399         return -1;
  1426 			return -1;
  1400     path.Insert(0, fp.Drive());
  1427 		path.Insert(0, fp.Drive());
  1401     }
  1428 		}
  1402   else
  1429 	else
  1403     {
  1430 		{
  1404     TChar drive;
  1431 		TChar drive;
  1405     if (((RFs *)(handle->fs))->DriveToChar(handle->fileHandleDrive, drive ) != KErrNone )
  1432 		if (((RFs *)(handle->fs))->DriveToChar(handle->fileHandleDrive, drive ) != KErrNone )
  1406         return -1;
  1433 			return -1;
  1407     path.Append( drive );
  1434 		path.Append( drive );
  1408     path.Append( _L(":") );
  1435 		path.Append( _L(":") );
  1409     path.Append( KTmpDirectoryName );
  1436 		path.Append( KTmpDirectoryName );
  1410     }
  1437 		}
       
  1438 	}
  1411     
  1439     
  1412   // Try to delete the temp folder from leftovers
  1440   // Try to delete the temp folder from leftovers
  1413   // If other instance is using it then delete will just fail
  1441   // If other instance is using it then delete will just fail
  1414   PRINT((_L("e_initmetadatafiles_newl_fileman 1")));
  1442   PRINT((_L("e_initmetadatafiles_newl_fileman 1")));
  1415   CFileMan* fileMan = 0;
  1443   CFileMan* fileMan = 0;