From f3306d5512ff15f4b15088d7a5e958cffd3bd477 Mon Sep 17 00:00:00 2001 From: Tigran Aivazian Date: Wed, 3 Oct 2012 19:56:36 +0100 Subject: [PATCH] Kill getDiskSizeInfo() function. Instead of making an extra function call, packing return values in key'd values of a table and then use two table indexing operations, just call util.df(".") directly from FileInfo:formatDiskSizeInfo() and use its two return values appropriately. --- fileinfo.lua | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/fileinfo.lua b/fileinfo.lua index 47fa59ed0..d3239090c 100644 --- a/fileinfo.lua +++ b/fileinfo.lua @@ -57,17 +57,9 @@ function getUnpackedZipSize(zipfile) return tonumber(res) end -function getDiskSizeInfo() - local t, f = util.df(".") - return { total = t, free = f } -end - function FileInfo:formatDiskSizeInfo() - local s = getDiskSizeInfo() - if s then - return self:FormatSize(s.free)..string.format(", %.2f", 100*s.free/s.total).."%" - end - return "?" + local t, f = util.df(".") + return self:FormatSize(f)..string.format(", %.2f", 100*f/t).."%" end function FileInfo:getFolderContent()