Engine 0.0.6
Game engine in lua
Loading...
Searching...
No Matches
fs.lua
Go to the documentation of this file.
1local function ls(src_path)
2 local ls_cmd = io.popen('ls -1 '..src_path)
3 local ls_files = {}
4
5 if ls_cmd then
6 repeat
7 local line = ls_cmd:read()
8 ls_files[#ls_files + 1] = line
9 until not line
10 ls_cmd:close()
11 end
12
13 return ls_files
14end
15
16local function clear(src_path)
17 if os.execute('rm -'..'-version > /dev/null 2> /dev//null') then
18 os.execute('mkdir -p '..src_path)
19 os.execute('rm -Rf '..src_path..'/*')
20 else
21 src_path = src_path:gsub('/', '\\')
22 os.execute('mkdir '..src_path)
23 os.execute('rmdir /s /q '..src_path..'\\*')
24 end
25end
26
27local function move(src_in, dist_out)
28 local src_file = io.open(src_in, "rb")
29 local dist_file = io.open(dist_out, "wb")
30
31 if src_file and dist_file then
32 repeat
33 local buffer = src_file:read(1024)
34 if buffer then
35 dist_file:write(buffer)
36 end
37 until not buffer
38 end
39
40 if src_file then
41 src_file:close()
42 end
43 if dist_file then
44 dist_file:close()
45 end
46end
47
48local P = {
49 ls = ls,
50 move = move,
51 clear = clear
52}
53
54return P
local function version()
local os
Definition build.lua:1
local function move(src_in, dist_out)
local function ls(src_path)
local function clear(src_path)
local function line(x1, y1, x2, y2)