1 function link_dir (dir, base)
2 local path = base.."/"..dir
3 local mode = lfs.attributes (path).mode
4 if mode == "directory" then
5 return string.format ('<a href="%s">%s</a>',
6 cgilua.mkurlpath ("test_fs.lua", { dir = path }),
14 cgilua.put ("<h1>Testing Filesystem library</h1>\n")
15 cgilua.put ("<table>\n")
16 cgilua.put ("<tr><td colspan=2>Testing <b>dir</b></td></tr>\n")
18 local dir = cgi.dir or "."
19 for file in lfs.dir (dir) do
21 cgilua.put ("<tr><td>"..i.."</td><td>"..link_dir(file, dir).."</td></tr>\n")
23 cgilua.put ("</table>\n")