ferron

Ferron is a fast and simple static website generator made with Lua.
Log | Files | Refs | Submodules | README | LICENSE

commit 71f424cbe2ff0c1149148062fa2d959a2613a57a
parent 184008e290df0c8cb3b311f6358519c98b340998
Author: Hugo Soucy <hugo.soucy@toumoro.com>
Date:   Sat, 22 Feb 2020 19:07:54 -0500

Create a method to get the date of the last updated file

Diffstat:
Mferron/utilities/file-utils.lua | 16+++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/ferron/utilities/file-utils.lua b/ferron/utilities/file-utils.lua @@ -118,7 +118,21 @@ function fileutils.isNotIndex(filepath) end function fileutils.isNonTextual(filepath) - return (tb.hasvalue(config.mimetypes, mimetypes.guess(filepath)) and true or false) + return ( + tb.hasvalue(config.mimetypes, mimetypes.guess(filepath)) and true or false + ) +end + +-- getlastmodified +function fileutils.getlastupdateddate(filelist) + return math.max(unpack(tb.map( + function(fl) + if fileutils.isFile(fl) then + return lfs.attributes(fl).modification + end + end, + filelist + ))) end -- getdirtree