Update appList.lua
This commit is contained in:
parent
04be0e2316
commit
e8b7dd9c29
1 changed files with 25 additions and 25 deletions
|
@ -1,34 +1,34 @@
|
||||||
sPhone.winOk("Work In","Progress")
|
sPhone.winOk("Work In","Progress")
|
||||||
local dir = "/.sPhone/apps/storeApps/"
|
local spkList = "/.sPhone/config/spklist"
|
||||||
if not fs.exists(dir) then
|
local dir = "/.sPhone/spk/"
|
||||||
fs.makeDir(dir)
|
if not fs.exists(spkList) then
|
||||||
end
|
config.list("/.sPhone/config/spklist")
|
||||||
|
end
|
||||||
|
|
||||||
|
local list = config.list("/.sPhone/config/spklist")
|
||||||
|
|
||||||
local apps = {}
|
local apps = {}
|
||||||
local appsName = {}
|
|
||||||
|
|
||||||
for k, v in pairs(fs.list(dir)) do
|
for k, v in pairs(list) do
|
||||||
if fs.isDir(dir..v) then
|
if fs.isDir("/.sPhone/spk/"..k) then
|
||||||
if fs.exists(dir..v.."/sPhone-Main.lua") then
|
if fs.exists(dir..k.."/.spk") then
|
||||||
local nDir = dir..v.."/sPhone-Main.lua"
|
local nDir = dir..k.."/.spk"
|
||||||
local f = fs.open(nDir,"r")
|
pDir = dir..k.."/.spk"
|
||||||
local sPhone_Main = f.readAll()
|
local name = config.read(pDir,"name")
|
||||||
f.close()
|
local author = config.read(pDir,"author")
|
||||||
sPhone_Main = textutils.unserialize(sPhone_Main)
|
local version = config.read(pDir,"version")
|
||||||
pDir = dir..v
|
local id = k
|
||||||
local run = sPhone_Main.main
|
|
||||||
local name = sPhone_Main.name
|
|
||||||
local author = sPhone_Main.author
|
|
||||||
local version = sPhone_Main.version
|
|
||||||
|
|
||||||
appsName[name] = dir..v.."/"..run
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for k, v in pairs(appsName) do
|
for k,v in pairs(config.list(spkList)) do
|
||||||
table.insert(apps, v)
|
table.insert(apps,{
|
||||||
|
id = k,
|
||||||
|
name = v,
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local function drawHome()
|
local function drawHome()
|
||||||
term.setBackgroundColor(sPhone.theme["backgroundColor"])
|
term.setBackgroundColor(sPhone.theme["backgroundColor"])
|
||||||
term.clear()
|
term.clear()
|
||||||
|
@ -38,8 +38,8 @@ sPhone.winOk("Work In","Progress")
|
||||||
term.setTextColor(sPhone.theme["text"])
|
term.setTextColor(sPhone.theme["text"])
|
||||||
|
|
||||||
term.setCursorPos(1,3)
|
term.setCursorPos(1,3)
|
||||||
for k, v in pairs(appsName) do
|
for k, v in pairs(apps) do
|
||||||
print(k)
|
print(v.name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ sPhone.winOk("Work In","Progress")
|
||||||
break
|
break
|
||||||
elseif y >= 2 then
|
elseif y >= 2 then
|
||||||
if apps[y-2] then
|
if apps[y-2] then
|
||||||
sPhone.run("/.sPhone/apps/storeApps/"..apps[y-2])
|
sPhone.launch(apps[y-2].id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue