voicerecorder/UtilsSrc/VRUtils.cpp
branchRCL_3
changeset 13 4e5b531d23cb
parent 0 845549f293a7
child 14 f962425b9f8b
--- a/voicerecorder/UtilsSrc/VRUtils.cpp	Tue Apr 27 16:40:59 2010 +0300
+++ b/voicerecorder/UtilsSrc/VRUtils.cpp	Tue May 11 16:15:58 2010 +0300
@@ -138,9 +138,9 @@
 		else
 			{			
             TUint status( 0 );
-	        VRUtils::GetDriveInfo(memoDrive, status);
+            TInt err = VRUtils::GetDriveInfo(memoDrive, status);
             // check if drive status is ok 
-			if ( (status & DriveInfo::EDrivePresent) && !(status & DriveInfo::EDriveLocked) &&
+			if ( ( err == KErrNone ) && (status & DriveInfo::EDrivePresent) && !(status & DriveInfo::EDriveLocked) &&
 				!( status & DriveInfo::EDriveCorrupt ) && !( status & DriveInfo::EDriveReadOnly ) )
 				{
 				// Drive usage is OK.
@@ -1053,6 +1053,29 @@
 	return mode;    
     }
 
+// ---------------------------------------------------------------------------
+// DriveValid checks the drive is valid or not
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool VRUtils::DriveValid( const TInt aDrive )
+    {
+    TUint status( 0 );
+    TBool flag( ETrue );
+    TInt err = VRUtils::GetDriveInfo( aDrive, status );
+    if ( err != KErrNone )
+    	{ flag = EFalse; }
+    else 
+    	{
+    	if ( !(status & DriveInfo::EDrivePresent) ||
+    			(status & DriveInfo::EDriveLocked) ||
+    			(status & DriveInfo::EDriveReadOnly) ||
+    			(status & DriveInfo::EDriveCorrupt) ||
+    			(status & DriveInfo::EDriveInUse) )
+    		{ flag = EFalse; }
+    	}
+    return flag;
+    
+    }
 
 #ifdef RD_MULTIPLE_DRIVE
 // ---------------------------------------------------------------------------
@@ -1103,7 +1126,7 @@
 EXPORT_C TInt VRUtils::DefaultMemoDriveL()
 	{
     TInt drive(0);
-    User::LeaveIfError( DriveInfo::GetDefaultDrive(DriveInfo::EDefaultPhoneMemory, drive ) );
+    User::LeaveIfError( DriveInfo::GetDefaultDrive(DriveInfo::EDefaultMassStorage, drive ) );
     return drive;
 	}
 
@@ -1113,10 +1136,11 @@
 // it is for multiple drive feature
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void VRUtils::GetDriveInfo( TInt aDrive, TUint& aDriveInfo )
+EXPORT_C TInt VRUtils::GetDriveInfo( TInt aDrive, TUint& aDriveInfo )
     {
 	RFs& iFs = CCoeEnv::Static()->FsSession() ;
-	DriveInfo::GetDriveStatus( iFs, aDrive, aDriveInfo ); 
+	TInt err = DriveInfo::GetDriveStatus( iFs, aDrive, aDriveInfo ); 
+	return err;
     }
 #endif