mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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.
This commit is contained in:
12
fileinfo.lua
12
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()
|
||||
|
||||
Reference in New Issue
Block a user