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