Tue, 16 Jan 2018 17:02:22 +0000
Update markdown; now Lua 5.3 compatible
2 | 1 | |
7
038275cd92ed
Convert module stuff to lua 5.3
Tuomo Valkonen <tuomov@iki.fi>
parents:
3
diff
changeset
|
2 | --@module handlers.copy |
038275cd92ed
Convert module stuff to lua 5.3
Tuomo Valkonen <tuomov@iki.fi>
parents:
3
diff
changeset
|
3 | |
038275cd92ed
Convert module stuff to lua 5.3
Tuomo Valkonen <tuomov@iki.fi>
parents:
3
diff
changeset
|
4 | local path=require("path") |
2 | 5 | |
7
038275cd92ed
Convert module stuff to lua 5.3
Tuomo Valkonen <tuomov@iki.fi>
parents:
3
diff
changeset
|
6 | local handlers_copy={} |
3 | 7 | |
7
038275cd92ed
Convert module stuff to lua 5.3
Tuomo Valkonen <tuomov@iki.fi>
parents:
3
diff
changeset
|
8 | local dependency=require("dependency") |
038275cd92ed
Convert module stuff to lua 5.3
Tuomo Valkonen <tuomov@iki.fi>
parents:
3
diff
changeset
|
9 | local log=require("log") |
038275cd92ed
Convert module stuff to lua 5.3
Tuomo Valkonen <tuomov@iki.fi>
parents:
3
diff
changeset
|
10 | |
038275cd92ed
Convert module stuff to lua 5.3
Tuomo Valkonen <tuomov@iki.fi>
parents:
3
diff
changeset
|
11 | function handlers_copy.phase1(file, env) |
2 | 12 | end |
13 | ||
7
038275cd92ed
Convert module stuff to lua 5.3
Tuomo Valkonen <tuomov@iki.fi>
parents:
3
diff
changeset
|
14 | function handlers_copy.phase2(file, env) |
3 | 15 | local src=path.join(env.paths.src, file) |
16 | local dst=path.join(env.paths.dst, file) | |
17 | if dependency.simple_update_check(dst, {src}) then | |
18 | log.log("Copy "..file.."\n") | |
19 | local f = io.openX(src, 'r') | |
20 | local dstf = io.openX(dst, 'w') | |
21 | while true do | |
22 | local data=f:read(1024*1024) | |
23 | if not data then | |
24 | break | |
25 | end | |
26 | dstf:write(data) | |
27 | end | |
28 | end | |
2 | 29 | end |
7
038275cd92ed
Convert module stuff to lua 5.3
Tuomo Valkonen <tuomov@iki.fi>
parents:
3
diff
changeset
|
30 | |
038275cd92ed
Convert module stuff to lua 5.3
Tuomo Valkonen <tuomov@iki.fi>
parents:
3
diff
changeset
|
31 | return handlers_copy |