Fix world config menu ignoring `name` in `mod.conf`.

master
Diego Martinez 2015-12-07 00:49:01 -03:00 committed by ShadowNinja
parent 735e3b7059
commit a594963a7d
1 changed files with 18 additions and 18 deletions

View File

@ -19,29 +19,29 @@
function get_mods(path,retval,modpack) function get_mods(path,retval,modpack)
local mods = core.get_dir_list(path, true) local mods = core.get_dir_list(path, true)
for i=1, #mods, 1 do for _, name in ipairs(mods) do
if mods[i]:sub(1,1) ~= "." then if name:sub(1, 1) ~= "." then
local prefix = path .. DIR_DELIM .. name .. DIR_DELIM
local toadd = {} local toadd = {}
local modpackfile = nil table.insert(retval, toadd)
toadd.name = mods[i] local mod_conf = Settings(prefix .. "mod.conf"):to_table()
toadd.path = path .. DIR_DELIM .. mods[i] .. DIR_DELIM if mod_conf.name then
if modpack ~= nil and name = mod_conf.name
modpack ~= "" then
toadd.modpack = modpack
else
local filename = path .. DIR_DELIM .. mods[i] .. DIR_DELIM .. "modpack.txt"
local error = nil
modpackfile,error = io.open(filename,"r")
end end
if modpackfile ~= nil then toadd.name = name
modpackfile:close() toadd.path = prefix
toadd.is_modpack = true
table.insert(retval,toadd) if modpack ~= nil and modpack ~= "" then
get_mods(path .. DIR_DELIM .. mods[i],retval,mods[i]) toadd.modpack = modpack
else else
table.insert(retval,toadd) local modpackfile = io.open(prefix .. "modpack.txt")
if modpackfile then
modpackfile:close()
toadd.is_modpack = true
get_mods(prefix, retval, name)
end
end end
end end
end end