Sun, 13 Sep 2009 22:22:47 +0300
Improvements
| 2 | 1 | |
| 2 | module("handlers.copy", package.seeall) | |
| 3 | ||
| 3 | 4 | require("dependency") | 
| 5 | require("log") | |
| 6 | ||
| 7 | function phase1(file, env) | |
| 2 | 8 | end | 
| 9 | ||
| 3 | 10 | function phase2(file, env) | 
| 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 | |
| 2 | 25 | end |