TInt64 GetFreeSpaceOfMMC(TInt& TotalSize)
{
TVolumeInfo volumeInfo;
//freeSpace will store number of free memory card in Bytes
TBuf<64> freeSpace;
TInt64 freeKBytes = 0;
TotalSize = 0;
//Contains drive information.
TDriveInfo driveInfo;
//check all drives from A to Z
for (TInt driveNumber = EDriveA; driveNumber <= EDriveZ; driveNumber++)
{
//Gets information of this drive
CEikonEnv::Static()->FsSession().Drive(driveInfo, driveNumber);
//if this drive is EMediaNANDFlash,we find drive of Memory card
// also reported my DiBo Members that on some devices it can be EMediaHardDisk
// ref: [http://discussion.forum.nokia.com/forum/showthread.php?t=156990]
if ((driveNumber!=EDriveC && driveInfo.iType == EMediaNANDFlash)
|| driveInfo.iType == EMediaHardDisk)
{
//recode its free space in bytes
CEikonEnv::Static()->FsSession().Volume(volumeInfo, driveNumber);
freeKBytes = volumeInfo.iFree / 1024;
TotalSize = volumeInfo.iSize/1024;
freeSpace.Num(freeKBytes);
break;
}
}
return freeKBytes;
}