trivial change to getting file size string

This commit is contained in:
Mitchell Livingston 2007-08-04 01:48:34 +00:00
parent 1ca0634856
commit a5fb8ef040
1 changed files with 4 additions and 4 deletions

View File

@ -47,21 +47,21 @@
if (size < 1024)
return [NSString stringWithFormat: NSLocalizedString(@"%lld bytes", "File size"), size];
float convertedSize = (float)size;
float convertedSize;
NSString * unit;
if (size < 1048576)
{
convertedSize /= 1024.0;
convertedSize = size / 1024.0;
unit = NSLocalizedString(@" KB", "File size (beware of leading space)");
}
else if (size < 1073741824)
{
convertedSize /= 1048576.0;
convertedSize = size / 1048576.0;
unit = NSLocalizedString(@" MB", "File size (beware of leading space)");
}
else
{
convertedSize /= 1073741824.0;
convertedSize = size / 1073741824.0;
unit = NSLocalizedString(@" GB", "File size (beware of leading space)");
}