commands/drvinfo/drvinfo.cpp
changeset 64 72ffa331d78d
parent 0 7f656887cf89
child 67 84fefe1cd57f
equal deleted inserted replaced
63:6a2083f7eeb8 64:72ffa331d78d
   153 		{
   153 		{
   154 		aPrintBuf.AppendFormatL(_L("%ld\r\n"), volInfo.iFree);
   154 		aPrintBuf.AppendFormatL(_L("%ld\r\n"), volInfo.iFree);
   155 		}
   155 		}
   156 	if (iVerbose)
   156 	if (iVerbose)
   157 		{
   157 		{
   158 		aPrintBuf.AppendFormatL(_L("VolName:\t\'%S\'"), &volInfo.iName);
   158 		aPrintBuf.AppendFormatL(_L("VolName:\t\'%S\'\r\n"), &volInfo.iName);
   159 		}
   159 		}
   160 	aPrintBuf.AppendL(_L("\r\n"));
       
   161 	}
   160 	}
   162 
   161 
   163 void CCmdDrvinfo::PrintDriveInfoL(TInt aDriveNum)
   162 void CCmdDrvinfo::PrintDriveInfoL(TInt aDriveNum)
   164 	{
   163 	{
   165 	IoUtils::CTextBuffer* buf = IoUtils::CTextBuffer::NewLC(0x100);
   164 	IoUtils::CTextBuffer* buf = IoUtils::CTextBuffer::NewLC(0x100);
   166 
   165 
   167 	TDriveInfo 	driveInfo;
   166 	TDriveInfo driveInfo;
   168 	User::LeaveIfError(FsL().Drive(driveInfo, aDriveNum));
   167 	User::LeaveIfError(FsL().Drive(driveInfo, aDriveNum));
   169 
   168 
   170 	TVolumeInfo volInfo;
   169 	TVolumeInfo volInfo;
   171 	User::LeaveIfError(Fs().Volume(volInfo, aDriveNum));
   170 	TInt volErr = Fs().Volume(volInfo, aDriveNum);
   172 
   171 
   173 	if (iVerbose || (iDriveLetter == NULL))
   172 	if (iVerbose || (iDriveLetter == NULL))
   174 		{
   173 		{
   175 		buf->AppendFormatL(_L("Drive:\t%c:\r\n"), 'A'+ aDriveNum);
   174 		buf->AppendFormatL(_L("Drive:\t%c:\r\n"), 'A'+ aDriveNum);
   176 		}
   175 		}
   189 		buf->AppendFormatL(_L("BatteryState:\t%d\r\n"),driveInfo.iBattery);
   188 		buf->AppendFormatL(_L("BatteryState:\t%d\r\n"),driveInfo.iBattery);
   190 		FormatDriveAttInfoL(driveInfo, *buf);
   189 		FormatDriveAttInfoL(driveInfo, *buf);
   191 		FormatMediaAttInfoL(driveInfo, *buf);
   190 		FormatMediaAttInfoL(driveInfo, *buf);
   192 		}
   191 		}
   193 
   192 
   194 	FormatVolInfoL(volInfo, *buf);
   193 	if (volErr == KErrNone) FormatVolInfoL(volInfo, *buf);
   195 
   194 
   196 	CTextFormatter* formatter = CTextFormatter::NewLC(Stdout());
   195 	CTextFormatter* formatter = CTextFormatter::NewLC(Stdout());
   197 	formatter->TabulateL(0, 2, buf->Descriptor());
   196 	formatter->TabulateL(0, 2, buf->Descriptor());
   198 	Write(formatter->Descriptor());
   197 	Write(formatter->Descriptor());
   199 
   198