92 posts
Posted 09 November 2012 - 07:36 AM
I would like to know if GitHub raw view would work with the HTTP Api if you are trying to make an update program. Would it? It would be helpful if it did, as I don't want to make a Pastebin account with a password I'd probbably forget.
2217 posts
Location
3232235883
Posted 09 November 2012 - 07:39 AM
Yes but you would also need a file to tell you where all the files you need to download are
92 posts
Posted 09 November 2012 - 07:41 AM
Yes but you would also need a file to tell you where all the files you need to download are
I meant, if I have a raw view of a file up on GitHub, (it has no formatting to it) would I be able to use it to update a program if it's out of date?
2447 posts
Posted 09 November 2012 - 07:55 AM
Yes, the https protocol is supported.
92 posts
Posted 09 November 2012 - 08:04 AM
Ok, thanks. But it seems I am getting errors…. Here's my code:
https://raw.github.com/DigiTechs/MCstuff/master/updatetestI don't get why it doesn't work, it should function fine.
The code i'm using in MC is:
local version =
0
function versioncheck()
term.clear()
term.setCursorPos(1,1)
print("Program loading...")
print("Current version: "..version)
local updateSite = http.get("https://raw.github.com/DigiTechs/Minecraftstuff/6bcf62fd71421eb5182605068f93c228f78b172b/updatetest")
local coding = updateSite.readLine(2)
local newVersion = (tonumber(coding))
sleep(2)
if tonumber(newVersion) > version then
print("Newest version is: "..newVersion)
print("Update required. Updating now...")
local updateSite = http.get("https://raw.github.com/DigiTechs/Minecraftstuff/6bcf62fd71421eb5182605068f93c228f78b172b/updatetest")
local siteFile = updateSite.readAll()
local writeFile = fs.open(shell.getRunningProgram(),"w")
writeFile.write(siteFile)
writeFile.close()
print("The program will now restart your computer.")
sleep(2)
os.reboot()
end
end
1214 posts
Location
The Sammich Kingdom
Posted 09 November 2012 - 08:44 AM
Please post a error log. Are you trying to pull a commit or what? Or do you have a folder named "6bcf62fd71421eb5182605068f93c228f78b172b"?
8543 posts
Posted 09 November 2012 - 08:45 AM
What version of ComputerCraft are you using?
92 posts
Posted 09 November 2012 - 09:04 AM
What version of ComputerCraft are you using?
It's 1.46 according to MultiMC's console.
92 posts
Posted 09 November 2012 - 09:05 AM
Please post a error log. Are you trying to pull a commit or what? Or do you have a folder named "6bcf62fd71421eb5182605068f93c228f78b172b"?
I'm getting no errors from the game, it just runs and "does nothing" - The actual link to get to the raw file is
https://raw.github.com/DigiTechs/Minecraftstuff/6bcf62fd71421eb5182605068f93c228f78b172b/updatetest - and I belive the 6bdcf thing is just the commit info.
236 posts
Location
Germany
Posted 09 November 2012 - 09:13 AM
https://github.com/K...o%20updater.luathere ya go
this pretty much downloads everything