I am currently working on the auto updater for CarbonOS again. It is so good! No more problems except one. http.get returns nil for some reason. I think the URL is correct. I even copied and pasted the Raw URL and it still returns nil.
Code:
local nextFile = "/.os"
local files = {
[1] = {
"/System/Images/boot",
"https://raw.githubusercontent.com/Carbon-OS/CarbonOS/master/System/Images/boot"
},
[2] = {
"startup",
"https://raw.githubusercontent.com/Carbon-OS/CarbonOS/master/startup"
},
[3] = {
"/Programs/LuaIDE/program",
"https://raw.githubusercontent.com/Carbon-OS/CarbonOS/master/Programs/LuaIDE/program"
},
[4] = {
"/Programs/Sketch/program",
"https://raw.githubusercontent.com/Carbon-OS/CarbonOS/master/Programs/Sketch/program"
},
[5] = {
"/Desktop/LuaIDE",
"https://raw.githubusercontent.com/Carbon-OS/CarbonOS/master/Desktop/LuaIDE"
},
[6] = {
"/Desktop/Sketch",
"https://raw.githubusercontent.com/Carbon-OS/CarbonOS/master/Desktop/Sketch"
},
[7] = {
"/System/Images/desktop",
"https://raw.githubusercontent.com/Carbon-OS/CarbonOS/master/System/Images/desktop"
},
[8] = {
"/System/settings",
"https://raw.githubusercontent.com/Carbon-OS/CarbonOS/master/System/settings"
},
[9] = {
"/System/autoupdater",
"https://raw.githubusercontent.com/Carbon-OS/CarbonOS/master/System/autoupdater"
},
[10] = {
"/System/.version",
"https://raw.githubusercontent.com/Carbon-OS/CarbonOS/master/System/.version"
},
[11] = {
"/os",
"https://raw.githubusercontent.com/Carbon-OS/CarbonOS/master/os"
}
}
remoteVersion = http.get("https://raw.githubusercontent.com/Carbon-OS/CarbonOS/master/System/.version")
local localVersion = fs.open("System/.version", "r")
local currentVer = localVersion.readAll()
local rVersion = remoteVerion.readAll()
local lVersion = localVersion.readAll()
localVersion.close()
if rVersion ~= lVersion then
print("Downloading Update...")
print("Your Verison: ", lVersion)
print("New Version: ", rVersion)
for k, v in pairs(files) do
local currentFile = fs.open(v[1], "w")
local remoteFile = http.get(v[2])
if remoteFile ~= nil then
currentFile.write(remoteFile.readAll)
end
currentFile.close()
remoteFile.close()
end
end
local next = fs.open(nextFile, "r")
pcall(loadstring(next.readAll()))
--Put code to run if the os crashes
If you would like to fix it, you can tell me or create a pull request (the easiest way is to create a pull request)
Github: https://github.com/Carbon-OS/CarbonOS/blob/master/System/autoupdater#L49
The highlighted line is the http.get that returns nil
Thank You!