pass current program to finishInstall

This commit is contained in:
jane 2021-06-06 00:56:56 -04:00
parent a7f0295fed
commit 721db1cd90
2 changed files with 14 additions and 3 deletions

View file

@ -85,6 +85,10 @@ local function getAllFiles(program)
end end
local function finishInstall(program, files) local function finishInstall(program, files)
if files == nil then
print("files var is nil")
error()
end
for key, file in ipairs(files) do for key, file in ipairs(files) do
if customPath ~= nil then if customPath ~= nil then
print("moving " .. file .. " to " .. customPath .. "...") print("moving " .. file .. " to " .. customPath .. "...")

View file

@ -104,7 +104,11 @@ local function getAllFiles(program)
end end
local function finishInstall(program, files) local function finishInstall(program, files)
for key, file in ipairs(files) do if files == nil then
print("files var is nil")
error()
end
for _, file in ipairs(files) do
if customPath ~= nil then if customPath ~= nil then
print("moving " .. file .. " to " .. customPath .. "...") print("moving " .. file .. " to " .. customPath .. "...")
if not fs.exists(customPath) then if not fs.exists(customPath) then
@ -145,13 +149,16 @@ if programToInstall == nil then
if value ~= "" and value ~= nil then if value ~= "" and value ~= nil then
print("checking for updates for " .. value) print("checking for updates for " .. value)
local files = getAllFiles(value) local files = getAllFiles(value)
if files ~= nil then
if #files == 0 then
print("no updates found.")
elseif files ~= nil then
for _, value2 in ipairs(files) do for _, value2 in ipairs(files) do
if value2 ~= nil then if value2 ~= nil then
downloadFile(value, value2) downloadFile(value, value2)
end end
end end
finishInstall(files) finishInstall(value, files)
end end
end end
end end