Skip to content
Snippets Groups Projects
Commit 4ef20b8a authored by dg's avatar dg
Browse files

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@4247 51575b47-30f0-44d4-a5cc-537603b46e54
parent c7e96529
No related branches found
No related tags found
No related merge requests found
......@@ -34,21 +34,23 @@ end
--- List all available modules
-- Static
function _M:listModules(incompatible)
function _M:listModules(incompatible, moddir_filter)
local ms = {}
fs.mount(engine.homepath, "/")
-- print("Search Path: ") for k,e in ipairs(fs.getSearchPath()) do print("*",k,e) end
local knowns = {}
for i, short_name in ipairs(fs.list("/modules/")) do
local mod = self:createModule(short_name, incompatible)
if mod then
if not knowns[mod.short_name] then
table.insert(ms, {short_name=mod.short_name, name=mod.name, versions={}})
knowns[mod.short_name] = ms[#ms]
if not moddir_filter or moddir_filter(short_name) then
local mod = self:createModule(short_name, incompatible)
if mod then
if not knowns[mod.short_name] then
table.insert(ms, {short_name=mod.short_name, name=mod.name, versions={}})
knowns[mod.short_name] = ms[#ms]
end
local v = knowns[mod.short_name].versions
v[#v+1] = mod
end
local v = knowns[mod.short_name].versions
v[#v+1] = mod
end
end
......@@ -156,10 +158,10 @@ end
--- List all available savefiles
-- Static
function _M:listSavefiles()
function _M:listSavefiles(moddir_filter)
-- fs.mount(engine.homepath, "/tmp/listsaves")
local mods = self:listModules()
local mods = self:listModules(nil, moddir_filter)
for _, mod in ipairs(mods) do
local lss = {}
for i, short_name in ipairs(fs.list("/"..mod.short_name.."/save/")) do
......
......@@ -31,7 +31,7 @@ module(..., package.seeall, class.inherit(Dialog))
function _M:init()
Dialog.init(self, "Load Game", game.w * 0.8, game.h * 0.8)
local list = Module:listSavefiles()
local list = Module:listSavefiles(function(dir) if dir:find("^boot") then return false else return true end end)
self.c_delete = Button.new{text="Delete", fct=function(text) self:deleteSave() end}
self.c_desc = Textzone.new{width=math.floor(self.iw / 3 * 2 - 10), height=self.ih - self.c_delete.h - 10, text=""}
......
......@@ -74,7 +74,7 @@ function _M:select(item)
end
function _M:generateList()
local list = Module:listModules(self.c_compat.checked)
local list = Module:listModules(self.c_compat.checked, function(dir) if dir:find("^boot") then return false else return true end end)
self.list = {}
for i = 1, #list do
for j, mod in ipairs(list[i].versions) do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment