summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2015-12-30 13:26:06 +0000
committerTed Trask <ttrask01@yahoo.com>2015-12-30 13:26:06 +0000
commit8c038f4b24750a0bc8d365f132fc7c43b8d2ec2b (patch)
treee4da5c3123dc6e7d56ca1018733d3c6c578c1a7d /lib
parentafacda9ac42ddd7128cbf65091b0f6aeb0c743cb (diff)
downloadacf-core-8c038f4b24750a0bc8d365f132fc7c43b8d2ec2b.tar.bz2
acf-core-8c038f4b24750a0bc8d365f132fc7c43b8d2ec2b.tar.xz
Change modelfunctions.getfiledetails to use size=actual size, not filesize=user friendly size
Diffstat (limited to 'lib')
-rw-r--r--lib/modelfunctions.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/modelfunctions.lua b/lib/modelfunctions.lua
index 2819911..3345dce 100644
--- a/lib/modelfunctions.lua
+++ b/lib/modelfunctions.lua
@@ -82,9 +82,9 @@ end
function mymodule.getfiledetails(file, validatefilename, validatefiledetails)
local filename = cfe({ value=file or "", label="File name" })
local filecontent = cfe({ type="longtext", label="File content" })
- local filesize = cfe({ value="0", label="File size" })
+ local size = cfe({ value="0", label="File size" })
local mtime = cfe({ value="---", label="File date" })
- local filedetails = cfe({ type="group", value={filename=filename, filecontent=filecontent, filesize=filesize, mtime=mtime}, label="Config file details" })
+ local filedetails = cfe({ type="group", value={filename=filename, filecontent=filecontent, size=size, mtime=mtime}, label="Config file details" })
local success = true
if type(validatefilename) == "function" then
success = validatefilename(filedetails.value.filename.value)
@@ -103,10 +103,10 @@ function mymodule.getfiledetails(file, validatefilename, validatefiledetails)
end
if success then
if fs.is_file(file) then
- local filedetails = fs.stat(file)
+ local filedetails = posix.stat(file)
filecontent.value = fs.read_file(file) or ""
- filesize.value = filedetails.size
- mtime.value = filedetails.mtime
+ size.value = format.formatfilesize(filedetails.size)
+ mtime.value = format.formattime(filedetails.mtime)
else
filename.errtxt = "File not found"
end