add debug statements

This commit is contained in:
jane 2021-06-06 01:05:34 -04:00
parent 6ca7a57233
commit 0e3404f92d

View file

@ -64,31 +64,35 @@ local function getAllFiles(program)
indexesFile.close() indexesFile.close()
end end
local result = http.post(updateUrl, currentFiles) print("#DEBUG currentFiles " .. currentFiles)
if result == nil then
local updateResult = http.post(updateUrl, currentFiles)
if updateResult == nil then
print("error! getting updates for " .. program) print("error! getting updates for " .. program)
error() error()
end end
local resultText = result.readAll() local updateText = updateResult.readAll()
local resultTable = split(resultText, "\n") print("#DEBUG updateText" .. updateText)
local updateTable = split(updateText, "\n")
local result2 = http.get(indexesUrl) local indexesResult = http.get(indexesUrl)
if result2 == nil then if indexesResult == nil then
print("error! getting indexes for " .. program) print("error! getting indexes for " .. program)
error() error()
end end
local resultText2 = result2.readAll() local indexesText = indexesResult.readAll()
local resultTable2 = split(resultText2, "\n") print("#DEBUG indexesText" .. indexesText)
local indexesTable = split(indexesText, "\n")
local newIndexesFile = fs.open(path .. program .. "/indexes.dat", "w") local newIndexesFile = fs.open(path .. program .. "/indexes.dat", "w")
newIndexesFile.write(resultText2) newIndexesFile.write(indexesText)
newIndexesFile.close() newIndexesFile.close()
print("wrote new indexes for " .. program) print("wrote new indexes for " .. program)
local finalResult = {} local finalResult = {}
for key, value in ipairs(resultTable2) do for key, value in ipairs(indexesTable) do
local filename = split(value, " ")[1] local filename = split(value, " ")[1]
for key2, value2 in ipairs(resultTable) do for key2, value2 in ipairs(updateTable) do
local valueTable = split(value2, " ") local valueTable = split(value2, " ")
if filename == valueTable[1] then if filename == valueTable[1] then
local filePath = path .. program .. "/" .. valueTable[1] local filePath = path .. program .. "/" .. valueTable[1]
@ -106,8 +110,8 @@ end
local function finishInstall(program, files) local function finishInstall(program, files)
if files == nil then if files == nil then
print("files var is nil") print("files var is nil")
error() error()
end end
for _, file in ipairs(files) do for _, file in ipairs(files) do
if customPath ~= nil then if customPath ~= nil then