This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Konlab's profile picture

How to create an automatic updating program?

Started by Konlab, 23 April 2014 - 06:30 PM
Konlab #1
Posted 23 April 2014 - 08:30 PM
Hi!
I want to crate an automatic updating program, I don't know anything about http API, only I know, that it exists :-) .
Can you help me please?
flaghacker #2
Posted 23 April 2014 - 09:00 PM
Can you be a little more specific?
flaghacker #3
Posted 23 April 2014 - 09:09 PM
Ok, nevermind, I assume you want to make a program install a fresh copy of himself when you tell him there is an update…

You can do two things:
1) Update every time the program starts
Make a pastebin account, make a new paste and put your program there. Now, instead of running your program directly, you make a "runner file":

shell.run("pastebin get <code> <name>")
shell.run("<name>")
Note that it will take a few seconds for your program to start, because it has to download itself every time it starts.
2)You could make a separate paste, with the update code in it. I'll explain that tomorrow, because typing on my phone is not the best ;)/>
Edited on 23 April 2014 - 07:11 PM
Lyqyd #4
Posted 23 April 2014 - 09:16 PM
It's really a bad idea to do automatic "updating" every time the program starts. The user should have to initiate an update, since most of the time, the program would download a completely identical version of itself anyway.