-
Notifications
You must be signed in to change notification settings - Fork 76
/
build_files_list.lua
53 lines (35 loc) · 1.14 KB
/
build_files_list.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
-- builds a file containing every source file in it
assert (package.loadlib ("lua_utils.dll", "luaopen_utils")) ()
function scan_dir (path, f)
-- find all files in that directory
local t = assert (utils.readdir (path .. "\\*"))
for k, v in pairs (t) do
if not v.hidden and
not v.system and
k:sub (1, 1) ~= "." then
-- recurse to process file or subdirectory
if v.directory then
scan_dir (path .. "\\" .. k, f)
else
f (path .. "\\" .. k, v)
end -- if
end -- if
end -- for
end -- scan_dir
files = {}
-- this function is called for every found file
function load_file (name, stats)
if string.match (name:lower (), "%.cpp$") or
string.match (name:lower (), "%.c$")then
table.insert (files, name)
end -- if
end -- load_file
scan_dir ("C:\\source\\mushclient", load_file)
table.sort (files)
fo = assert (io.open ("all_files_list.txt", "w"))
for _, name in ipairs (files) do
name = string.gsub (name, "^C:\\source\\mushclient\\", "/cygdrive/c/source/mushclient/")
name = string.gsub (name, "\\", "/")
fo:write (name .. "\n")
end -- for
fo:close ()