Skip to content

Commit

Permalink
Added Files txt and Installer WIP
Browse files Browse the repository at this point in the history
Co-authored-by: Josh <[email protected]>
  • Loading branch information
ChristophLHR and ColdIV committed Dec 7, 2023
1 parent b55f597 commit 73519b4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
7 changes: 7 additions & 0 deletions files.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
scm.lua
/libs/scm/autocomplete.lua
/libs/scm/config.lua
/libs/scm/log.lua
/libs/scm/net.lua
/libs/scm/scriptManager.lua
/libs/scm/ui.lua
43 changes: 43 additions & 0 deletions scmInstaller.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
--installs the scm files into the game
---@class SCMInstaller
local SCMInstaller = {}


local files = {}
local source = "raw.githubusercontent.com/mc-cc-scripts/script-manager/Issue-30-Spilt-SCM/"


function SCMInstaller:getFilesTxt()
http.get(source .. "files.txt", nil, function(response)
local file = response.readLine()
while file ~= nil do
table.insert(files, file)
file = response.readLine()
end
response.close()
end)
end

function SCMInstaller:delteFiles()
for _, value in ipairs(files) do
print("Deleting File " .. value)
if fs.exists(value) then
fs.delete(value)
end
end
end

-- download the files
function SCMInstaller:downloadFiles()
for index, value in ipairs(files) do
http.get(source .. value, nil, function(response)
print('Downloading ' .. index .. ' of ' .. #files .. ' files: ' .. value)
local file = fs.open(value, "w")
file.write(response.readAll())
file.close()
response.close()
end)
end
end

return SCMInstaller

0 comments on commit 73519b4

Please sign in to comment.