Posted 25 April 2014 - 03:07 PM
So, I've made an installer that pulls files from my github.
What am I doing wrong here? It's not working, regardless of what I try.
Any help is welcomed.
EDIT: Updated code.
EDIT: Fixed code spacing.
What am I doing wrong here? It's not working, regardless of what I try.
-- GitGET Function
--
-- Written for Sir_Mr_Bmans GitHub
local function gitGet(file, save)
if fs.exists("/dwnlds") then
fs.delete("/dwnlds")
end
fs.makeDir("/dwnlds")
term.setTextColor(colors.purple)
print("[GitGET] Getting file: "..file)
local response = http.get(
"https://raw.githubusercontent.com/Sir-Mr-Bman/IndustrialSecurity/master/src/"..textutils.urlEncode(file)..".lua"
)
if response then
print("[GitGET] Server responded. Downloading...")
local save = response.readAll()
response.close()
local h = fs.open("/dwnlds/"..save, "w")
h.write(save)
h.close()
print("[GitGET] File downloaded.")
else
print("[GitGET] Server did not respond. Is it offline?")
print("[GitGET] Check your internet connection, and firewall settings.")
end
end
Any help is welcomed.
EDIT: Updated code.
EDIT: Fixed code spacing.
Edited on 25 April 2014 - 01:16 PM