ComputerCraft Archive

Updater

computer utility chibbi github

Description

Updater from chibbi/ComputerCraftScripts

Installation

Copy one of these commands into your ComputerCraft terminal:

wget:wget https://raw.githubusercontent.com/chibbi/ComputerCraftScripts/main/Updater.lua updater
Archive:wget https://cc.shobie.xyz/cc/get/gh-chibbi-ComputerCraftScripts-updater updater
Quick Install: wget https://cc.shobie.xyz/cc/get/gh-chibbi-ComputerCraftScripts-updater Updater

Usage

Run: Updater

Tags

none

Source

View Original Source

Code Preview

local dire = "ChibbiScripts/"
local url = "https://raw.githubusercontent.com/chibbi/ComputerCraftScripts/main/"

if(fs.exists(dire)) then
    fs.delete(dire)
end
fs.makeDir(dire)

local primaryRequest = http.get(url .. "scriptList.txt")
local allFiles = {}
local temp = primaryRequest.readAll()
temp:gsub(".",function(c) table.insert(allFiles,c) end)
for i = 1, #allFiles, 1 do
    local fileName = allFiles[i]
    local request = http.get(url .. fileName)
    local err, file = fs.open(dire .. fileName, "w") -- => FIXME: file doesn't exist yet
    file.write(request.readAll())
end