getting ready for install script

This commit is contained in:
2025-12-23 18:10:10 -08:00
parent 7c1e0de4ff
commit 5a9fa01cd7
8 changed files with 95 additions and 20315 deletions

58
scan.lua Normal file
View File

@@ -0,0 +1,58 @@
local exceptions = {
["/scan.lua"] = true,
["/install.lua"] = true,
["scan.lua"] = true,
["install.lua"] = true,
["/.settings"] = true,
[".settings"] = true,
["/.git"] = true,
[".git"] = true,
["/rom"] = true,
["rom"] = true,
["/scan.dat"] = true,
["scan.dat"] = true
}
local function scan(dir)
local out = {}
for _,i in ipairs(fs.list(dir)) do
local path = fs.combine(dir,i)
if exceptions[path] == nil then
if fs.isDir(path) then
out[i] = scan(path)
else
local file = fs.open(path,"r")
out[i] = file.readAll()
file.close()
end
end
end
return out
end
local function format(scandata)
local format_data = {
files = {},
dirs = {}
}
local function scan_format(dir,data)
if type(data) == "table" then
local has_scanned = false
for k,v in pairs(data) do
has_scanned = true
scan_format(fs.combine(dir,k),v)
end
if not has_scanned then
format_data.dirs[#format_data.dirs+1] = dir
end
else
format_data.files[#format_data.files+1] = dir
end
end
scan_format("/",scandata)
return format_data
end
local textdata = textutils.serialise(format(scan("/")))
local firstpart = ""
local secondpart = ""
local outfile = fs.open("install.lua","w")
outfile.write()
outfile.close()