scan.lua

changeset 3
b2df1b3f2c83
parent 2
3975fa5ed630
child 7
038275cd92ed
equal deleted inserted replaced
2:3975fa5ed630 3:b2df1b3f2c83
22 for f in filtered_dir(d) do 22 for f in filtered_dir(d) do
23 local n=d..'/'..f 23 local n=d..'/'..f
24 local a=lfs.attributes(n) 24 local a=lfs.attributes(n)
25 if a.mode=='directory' then 25 if a.mode=='directory' then
26 local nh=scan(n) 26 local nh=scan(n)
27 h[n]=nh 27 h[f]=nh
28 elseif a.mode=='file' then 28 elseif a.mode=='file' then
29 h[f]=true 29 h[f]=true
30 end 30 end
31 end 31 end
32 return h 32 return h
40 g(a, n) 40 g(a, n)
41 end 41 end
42 end 42 end
43 end 43 end
44 44
45 function map(h, g) 45 function map(h, g, d)
46 local function dir(prefix, name) 46 local function dir(prefix, name)
47 return path.join(prefix, name) 47 local p=path.join(prefix, name)
48 if d then
49 d(p)
50 end
51 return p
48 end 52 end
49 53
50 local function file(prefix, name) 54 local function file(prefix, name)
51 local f=path.join(prefix, name) 55 local f=path.join(prefix, name)
52 g(f) 56 g(f)

mercurial