display terabytes for file size when applicable

This commit is contained in:
Mitchell Livingston 2007-10-10 23:17:44 +00:00
parent 5b333ccc85
commit 66a7a1f220
1 changed files with 6 additions and 1 deletions

View File

@ -54,11 +54,16 @@
convertedSize = size / 1048576.0;
unit = NSLocalizedString(@"MB", "File size");
}
else
else if (size < 1099511627776.0)
{
convertedSize = size / 1073741824.0;
unit = NSLocalizedString(@"GB", "File size");
}
else
{
convertedSize = size / 1099511627776.0;
unit = NSLocalizedString(@"TB", "File size");
}
//attempt to have minimum of 3 digits with at least 1 decimal
return [NSString stringWithFormat: convertedSize < 10.0 ? @"%.2f %@" : @"%.1f %@", convertedSize, unit];