diff -r e2face1be50e -r 3975fa5ed630 scan.lua --- a/scan.lua Tue Mar 17 21:39:41 2009 +0200 +++ b/scan.lua Sat Sep 12 21:27:57 2009 +0300 @@ -1,4 +1,8 @@ + +module("scan", package.seeall) + require('lfs') +require('path') local function filtered_dir(d) local f, s_, v_ = lfs.dir(d) @@ -13,7 +17,6 @@ return g, s_, v_ end - function scan(d) local h={} for f in filtered_dir(d) do @@ -23,7 +26,7 @@ local nh=scan(n) h[n]=nh elseif a.mode=='file' then - h[n]=true + h[f]=true end end return h @@ -38,3 +41,16 @@ end end end + +function map(h, g) + local function dir(prefix, name) + return path.join(prefix, name) + end + + local function file(prefix, name) + local f=path.join(prefix, name) + g(f) + end + + hfold(h, "", dir, file) +end