handlers/copy.lua

changeset 3
b2df1b3f2c83
parent 2
3975fa5ed630
child 7
038275cd92ed
equal deleted inserted replaced
2:3975fa5ed630 3:b2df1b3f2c83
1 1
2 module("handlers.copy", package.seeall) 2 module("handlers.copy", package.seeall)
3 3
4 function phase1(f, env) 4 require("dependency")
5 require("log")
6
7 function phase1(file, env)
5 end 8 end
6 9
7 function phase2(f, env) 10 function phase2(file, env)
8 -- copy here! 11 local src=path.join(env.paths.src, file)
12 local dst=path.join(env.paths.dst, file)
13 if dependency.simple_update_check(dst, {src}) then
14 log.log("Copy "..file.."\n")
15 local f = io.openX(src, 'r')
16 local dstf = io.openX(dst, 'w')
17 while true do
18 local data=f:read(1024*1024)
19 if not data then
20 break
21 end
22 dstf:write(data)
23 end
24 end
9 end 25 end

mercurial