lsnes rr2-β24
[lsnes.git] / src / genfilelist.lua
blobc6110425b3ce09382c9fe75b1ecc2fe7291a58bf
1 #!/usr/bin/env lua
3 emit=function(filename)
4 local prefix, file, line, err, word;
5 if string.match(filename, "%.%./(.*)") then
6 return;
7 end
8 prefix = string.match(filename, "(.*/)[^/]*");
9 if not prefix then
10 io.stdout:write(" " .. filename);
11 return;
12 end
13 file, err = io.open(filename, "r");
14 if not file then
15 error(err);
16 end
17 s = "";
18 for line in file:lines() do
19 for word in string.gmatch(line, "%S+") do
20 s = s .. " " .. prefix .. word;
21 end
22 end
23 io.stdout:write(s);
24 end
26 for i=1,#arg do
27 emit(arg[i]);
28 end
29 print("");