voicerecorder/UtilsSrc/VRUtils.cpp
branchRCL_3
changeset 13 4e5b531d23cb
parent 0 845549f293a7
child 14 f962425b9f8b
equal deleted inserted replaced
11:a2fdc35b8f46 13:4e5b531d23cb
   136 			}
   136 			}
   137 		// other drives
   137 		// other drives
   138 		else
   138 		else
   139 			{			
   139 			{			
   140             TUint status( 0 );
   140             TUint status( 0 );
   141 	        VRUtils::GetDriveInfo(memoDrive, status);
   141             TInt err = VRUtils::GetDriveInfo(memoDrive, status);
   142             // check if drive status is ok 
   142             // check if drive status is ok 
   143 			if ( (status & DriveInfo::EDrivePresent) && !(status & DriveInfo::EDriveLocked) &&
   143 			if ( ( err == KErrNone ) && (status & DriveInfo::EDrivePresent) && !(status & DriveInfo::EDriveLocked) &&
   144 				!( status & DriveInfo::EDriveCorrupt ) && !( status & DriveInfo::EDriveReadOnly ) )
   144 				!( status & DriveInfo::EDriveCorrupt ) && !( status & DriveInfo::EDriveReadOnly ) )
   145 				{
   145 				{
   146 				// Drive usage is OK.
   146 				// Drive usage is OK.
   147                 User::LeaveIfError( PathInfo::GetRootPath( phoneMemoryPath, memoDrive ) );
   147                 User::LeaveIfError( PathInfo::GetRootPath( phoneMemoryPath, memoDrive ) );
   148 			    phoneMemoryPath.Append( PathInfo::DigitalSoundsPath() );
   148 			    phoneMemoryPath.Append( PathInfo::DigitalSoundsPath() );
  1051 
  1051 
  1052 
  1052 
  1053 	return mode;    
  1053 	return mode;    
  1054     }
  1054     }
  1055 
  1055 
       
  1056 // ---------------------------------------------------------------------------
       
  1057 // DriveValid checks the drive is valid or not
       
  1058 // ---------------------------------------------------------------------------
       
  1059 //
       
  1060 EXPORT_C TBool VRUtils::DriveValid( const TInt aDrive )
       
  1061     {
       
  1062     TUint status( 0 );
       
  1063     TBool flag( ETrue );
       
  1064     TInt err = VRUtils::GetDriveInfo( aDrive, status );
       
  1065     if ( err != KErrNone )
       
  1066     	{ flag = EFalse; }
       
  1067     else 
       
  1068     	{
       
  1069     	if ( !(status & DriveInfo::EDrivePresent) ||
       
  1070     			(status & DriveInfo::EDriveLocked) ||
       
  1071     			(status & DriveInfo::EDriveReadOnly) ||
       
  1072     			(status & DriveInfo::EDriveCorrupt) ||
       
  1073     			(status & DriveInfo::EDriveInUse) )
       
  1074     		{ flag = EFalse; }
       
  1075     	}
       
  1076     return flag;
       
  1077     
       
  1078     }
  1056 
  1079 
  1057 #ifdef RD_MULTIPLE_DRIVE
  1080 #ifdef RD_MULTIPLE_DRIVE
  1058 // ---------------------------------------------------------------------------
  1081 // ---------------------------------------------------------------------------
  1059 // VRUtils::SetMemoDriveL
  1082 // VRUtils::SetMemoDriveL
  1060 // 
  1083 // 
  1101 // ---------------------------------------------------------------------------
  1124 // ---------------------------------------------------------------------------
  1102 //
  1125 //
  1103 EXPORT_C TInt VRUtils::DefaultMemoDriveL()
  1126 EXPORT_C TInt VRUtils::DefaultMemoDriveL()
  1104 	{
  1127 	{
  1105     TInt drive(0);
  1128     TInt drive(0);
  1106     User::LeaveIfError( DriveInfo::GetDefaultDrive(DriveInfo::EDefaultPhoneMemory, drive ) );
  1129     User::LeaveIfError( DriveInfo::GetDefaultDrive(DriveInfo::EDefaultMassStorage, drive ) );
  1107     return drive;
  1130     return drive;
  1108 	}
  1131 	}
  1109 
  1132 
  1110 
  1133 
  1111 // ---------------------------------------------------------------------------
  1134 // ---------------------------------------------------------------------------
  1112 // VRUtils::Get drive Info
  1135 // VRUtils::Get drive Info
  1113 // it is for multiple drive feature
  1136 // it is for multiple drive feature
  1114 // ---------------------------------------------------------------------------
  1137 // ---------------------------------------------------------------------------
  1115 //
  1138 //
  1116 EXPORT_C void VRUtils::GetDriveInfo( TInt aDrive, TUint& aDriveInfo )
  1139 EXPORT_C TInt VRUtils::GetDriveInfo( TInt aDrive, TUint& aDriveInfo )
  1117     {
  1140     {
  1118 	RFs& iFs = CCoeEnv::Static()->FsSession() ;
  1141 	RFs& iFs = CCoeEnv::Static()->FsSession() ;
  1119 	DriveInfo::GetDriveStatus( iFs, aDrive, aDriveInfo ); 
  1142 	TInt err = DriveInfo::GetDriveStatus( iFs, aDrive, aDriveInfo ); 
       
  1143 	return err;
  1120     }
  1144     }
  1121 #endif
  1145 #endif
  1122 
  1146 
  1123 
  1147 
  1124 //  End of File
  1148 //  End of File