Posted 13 February 2014 - 05:14 PM
Hey everybody,
Recently i started playing on a server and of cause started playing with CC as well. It soon became annoying to get the updated files from my local editor to the server via pastebin so i made a really small util to download stuff from dropbox.
IMPORTANT NOTE:
you get the right dropbox link by clicking on "share link" and replacing "www" with "dl"
ex.
original: https://www.dropbox....dasdas/test.lua
correct: https://dl.dropbox.c...dasdas/test.lua
getUpdate will download a file and replaces and old file with it, genUpdater will generate a program called updater. This will one-click update or "sync" the specified file.
I found this usefull on many occasions already and hope someone here will, too
Edit: fixed some stupid mistakes
Recently i started playing on a server and of cause started playing with CC as well. It soon became annoying to get the updated files from my local editor to the server via pastebin so i made a really small util to download stuff from dropbox.
IMPORTANT NOTE:
you get the right dropbox link by clicking on "share link" and replacing "www" with "dl"
ex.
original: https://www.dropbox....dasdas/test.lua
correct: https://dl.dropbox.c...dasdas/test.lua
local Version = 2.7
local dDl = "https://dl.dropbox.com/s/somerandomstring/example.lua"
function getVersion()
return Version
end
function getDl()
return dDl
end
function getUpdate(filename,dl)
local newV = http.get(dl)
local update = fs.open("update","w")
update.write(newV.readAll())
update.close()
fs.move(filename,"old")
fs.move("update",filename)
fs.delete("old")
end
function genUpdater(filename,dl)
if not dl then dl = dDl end
local updater = fs.open("updater","w")
updater.write('local dDl = "'..dl..'" \nfunction getUpdate(filename,dl) \n local newV = http.get(dl) \n local update = fs.open("update","w") \n update.write(newV.readAll()) \n update.close() \n fs.move(filename,"old") \n fs.move("update",filename) \n fs.delete("old") \nend \n')
updater.write('getUpdate("'..filename..'",dDl)')
updater.close()
end
getUpdate will download a file and replaces and old file with it, genUpdater will generate a program called updater. This will one-click update or "sync" the specified file.
I found this usefull on many occasions already and hope someone here will, too
Edit: fixed some stupid mistakes
Edited on 14 February 2014 - 06:47 AM