-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinstaller.lua
More file actions
70 lines (63 loc) · 1.75 KB
/
Copy pathinstaller.lua
File metadata and controls
70 lines (63 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
local shell = require("shell")
local filesystem = require("filesystem")
local internet = require("internet")
local repo = "https://raw.githubusercontent.com/hxync/BeeMasterXXL/"
local branch = "main"
local paths = { "lib" }
local scripts = {
"strategy.lua",
"config.lua",
"bee.lua",
"analyzeGenes.lua",
"beeData.lua",
"bot.lua",
"doUntil.lua",
"environment.lua",
"tools.lua",
"biomes.lua",
"mutations.lua",
"device.lua",
"apiary.lua",
"lib/inflate-bwo.lua",
"lib/nbt.lua",
"lib/zzlib.lua"
}
local function download(url)
local handle = internet.request(url)
local result = ""
for chunk in handle do
result = result..chunk
end
return result
end
local function writeFile(path, content)
local file = io.open(path, "w")
file:write(content)
file:close()
end
local function exists(filename)
return filesystem.exists(shell.getWorkingDirectory() .. "/" .. filename)
end
local function main()
for i = 1, #paths do
local dir = shell.getWorkingDirectory() .. "/" .. paths[i]
if not filesystem.exists(dir) then
filesystem.makeDirectory(dir)
end
end
for i = 1, #scripts do
local file_path = shell.getWorkingDirectory() .. "/" .. scripts[i]
if exists(scripts[i]) then
filesystem.remove(file_path)
end
local url = string.format("%s%s/%s", repo, branch, scripts[i])
print("Downloading /"..scripts[i])
local content = download(url)
writeFile(file_path, content)
end
end
if pcall(download, "http://www.msftconnecttest.com/connecttest.txt") then
main()
else
print("Error: Internet Disconnected")
end