| 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 |