Skip to content

Commit a594963

Browse files
kaezaShadowNinja
authored andcommittedJan 24, 2016
Fix world config menu ignoring name in mod.conf.
1 parent 735e3b7 commit a594963

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed
 

Diff for: ‎builtin/mainmenu/modmgr.lua

+18-18
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,29 @@
1919
function get_mods(path,retval,modpack)
2020
local mods = core.get_dir_list(path, true)
2121

22-
for i=1, #mods, 1 do
23-
if mods[i]:sub(1,1) ~= "." then
22+
for _, name in ipairs(mods) do
23+
if name:sub(1, 1) ~= "." then
24+
local prefix = path .. DIR_DELIM .. name .. DIR_DELIM
2425
local toadd = {}
25-
local modpackfile = nil
26+
table.insert(retval, toadd)
2627

27-
toadd.name = mods[i]
28-
toadd.path = path .. DIR_DELIM .. mods[i] .. DIR_DELIM
29-
if modpack ~= nil and
30-
modpack ~= "" then
31-
toadd.modpack = modpack
32-
else
33-
local filename = path .. DIR_DELIM .. mods[i] .. DIR_DELIM .. "modpack.txt"
34-
local error = nil
35-
modpackfile,error = io.open(filename,"r")
28+
local mod_conf = Settings(prefix .. "mod.conf"):to_table()
29+
if mod_conf.name then
30+
name = mod_conf.name
3631
end
3732

38-
if modpackfile ~= nil then
39-
modpackfile:close()
40-
toadd.is_modpack = true
41-
table.insert(retval,toadd)
42-
get_mods(path .. DIR_DELIM .. mods[i],retval,mods[i])
33+
toadd.name = name
34+
toadd.path = prefix
35+
36+
if modpack ~= nil and modpack ~= "" then
37+
toadd.modpack = modpack
4338
else
44-
table.insert(retval,toadd)
39+
local modpackfile = io.open(prefix .. "modpack.txt")
40+
if modpackfile then
41+
modpackfile:close()
42+
toadd.is_modpack = true
43+
get_mods(prefix, retval, name)
44+
end
4545
end
4646
end
4747
end

0 commit comments

Comments
 (0)
Please sign in to comment.