Skip to content

Commit 73519b4

Browse files
ChristophLHRColdIV
andcommitted
Added Files txt and Installer WIP
Co-authored-by: Josh <[email protected]>
1 parent b55f597 commit 73519b4

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

files.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
scm.lua
2+
/libs/scm/autocomplete.lua
3+
/libs/scm/config.lua
4+
/libs/scm/log.lua
5+
/libs/scm/net.lua
6+
/libs/scm/scriptManager.lua
7+
/libs/scm/ui.lua

scmInstaller.lua

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
--installs the scm files into the game
2+
---@class SCMInstaller
3+
local SCMInstaller = {}
4+
5+
6+
local files = {}
7+
local source = "raw.githubusercontent.com/mc-cc-scripts/script-manager/Issue-30-Spilt-SCM/"
8+
9+
10+
function SCMInstaller:getFilesTxt()
11+
http.get(source .. "files.txt", nil, function(response)
12+
local file = response.readLine()
13+
while file ~= nil do
14+
table.insert(files, file)
15+
file = response.readLine()
16+
end
17+
response.close()
18+
end)
19+
end
20+
21+
function SCMInstaller:delteFiles()
22+
for _, value in ipairs(files) do
23+
print("Deleting File " .. value)
24+
if fs.exists(value) then
25+
fs.delete(value)
26+
end
27+
end
28+
end
29+
30+
-- download the files
31+
function SCMInstaller:downloadFiles()
32+
for index, value in ipairs(files) do
33+
http.get(source .. value, nil, function(response)
34+
print('Downloading ' .. index .. ' of ' .. #files .. ' files: ' .. value)
35+
local file = fs.open(value, "w")
36+
file.write(response.readAll())
37+
file.close()
38+
response.close()
39+
end)
40+
end
41+
end
42+
43+
return SCMInstaller

0 commit comments

Comments
 (0)