forked from PathOfBuildingCommunity/PathOfBuilding
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLaunchInstall.lua
More file actions
Latest commit
55 lines (51 loc) · 1.33 KB
/
Copy pathLaunchInstall.lua
File metadata and controls
55 lines (51 loc) · 1.33 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
#@ SimpleGraphic
-- Path of Building
--
-- Module: Launch Install
-- Installation bootstrap
--
localbasicFiles= { "UpdateCheck.lua", "UpdateApply.lua", "Launch.lua" }
localxml=require("xml")
localcurl=require("lcurl.safe")
ConClear()
ConPrintf("Preparing to complete installation...\n")
locallocalBranch, localSource
locallocalManXML=xml.LoadXMLFile("manifest.xml")
iflocalManXMLandlocalManXML[1].elem=="PoBVersion" then
for_, nodeinipairs(localManXML[1]) do
iftype(node) =="table" then
ifnode.elem=="Version" then
localBranch=node.attrib.branch
elseifnode.elem=="Source" then
ifnode.attrib.part=="program" then
localSource=node.attrib.url
end
end
end
end
end
ifnotlocalBranchornotlocalSourcethen
Exit("Install failed. (Missing or invalid manifest)")
return
end
localSource=localSource:gsub("{branch}", localBranch)
for_, nameinipairs(basicFiles) do
localtext=""
localeasy=curl.easy()
easy:setopt_url(localSource..name)
easy:setopt_writefunction(function(data)
text=text..data
returntrue
end)
easy:perform()
localsize=easy:getinfo(curl.INFO_SIZE_DOWNLOAD)
easy:close()
ifsize==0then
Exit("Install failed. (Couldn't download program files)")
return
end
localoutFile=io.open(name, "wb")
outFile:write(text)
outFile:close()
end
Restart()