-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcc-upg-builder.lua
More file actions
74 lines (59 loc) · 1.77 KB
/
Copy pathcc-upg-builder.lua
File metadata and controls
74 lines (59 loc) · 1.77 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
--
-- Very simple mkisofs example. Quite innacurate though: you shouldn't have
-- filenames exceeding common DOS 8.3 naming scheme.
--
-- You may use it this way: cd-tool -o iso.bin -e "main()" mkisofs.lua
--
function r_mkisofs(dirname, l_dirtree)
local file, r_dirtree
print("Processing directory " .. dirname)
for file in dir(dirname) do
if (file.type == FLAG_DIR) then
print("Processing subdir " .. file.name)
if (not ((file.name == ".") or (file.name == ".."))) then
r_dirtree = iso:createdir(l_dirtree, string.upper(file.name), 16)
r_dirtree:setbasicsxa()
if (dirtemplate ~= nil) then
r_dirtree:fromdir(dirtemplate)
end
r_mkisofs(dirname .. "/" .. file.name, r_dirtree)
end
else
print("Processing file " .. file.name)
r_dirtree = iso:createfile(l_dirtree, string.upper(file.name), Input(dirname .. "/" .. file.name))
r_dirtree:setbasicsxa()
if (dirtemplate ~= nil) then
r_dirtree:fromdir(dirtemplate)
end
end
end
end
function mkisofs(dirname)
local pvd, root, falsesect
falsesect = {}
if (cdutil == nil) then
iso:foreword_array(falsesect)
pvd = createpvd_array(falsesect)
else
iso:foreword(cdutil)
pvd = createpvd(cdutil)
dirtemplate = cdutil:findpath "/"
end
root = iso:setbasics(pvd, 16)
root:setbasicsxa()
if (dirtemplate ~= nil) then
root:fromdir(dirtemplate)
end
r_mkisofs(dirname, root)
print "Adding dummy sectors"
for i = 1, 15000, 1 do
iso:createsector(falsesect, MODE2_FORM1)
end
for i = 1, 150, 1 do
iso:createsector(falsesect, MODE2)
end
iso:close()
end
function main()
mkisofs("FILES")
end