aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorDiego Martinez <kaeza@users.sf.net>2015-12-07 00:49:01 -0300
committerShadowNinja <shadowninja@minetest.net>2016-01-23 21:14:14 -0500
commita594963a7dad2f1ea3d4904610033164983a1389 (patch)
treed28804cb1b2c4114c8e0eac8a66d7558548ee423 /builtin
parent735e3b70596e16d04de1edcd878deec3c539c6ed (diff)
downloadminetest-a594963a7dad2f1ea3d4904610033164983a1389.tar.gz
minetest-a594963a7dad2f1ea3d4904610033164983a1389.tar.bz2
minetest-a594963a7dad2f1ea3d4904610033164983a1389.zip
Fix world config menu ignoring `name` in `mod.conf`.
Diffstat (limited to 'builtin')
-rw-r--r--builtin/mainmenu/modmgr.lua36
1 files changed, 18 insertions, 18 deletions
diff --git a/builtin/mainmenu/modmgr.lua b/builtin/mainmenu/modmgr.lua
index 89292ed52..41e747b33 100644
--- a/builtin/mainmenu/modmgr.lua
+++ b/builtin/mainmenu/modmgr.lua
@@ -19,29 +19,29 @@
function get_mods(path,retval,modpack)
local mods = core.get_dir_list(path, true)
- for i=1, #mods, 1 do
- if mods[i]:sub(1,1) ~= "." then
+ for _, name in ipairs(mods) do
+ if name:sub(1, 1) ~= "." then
+ local prefix = path .. DIR_DELIM .. name .. DIR_DELIM
local toadd = {}
- local modpackfile = nil
+ table.insert(retval, toadd)
- toadd.name = mods[i]
- toadd.path = path .. DIR_DELIM .. mods[i] .. DIR_DELIM
- if modpack ~= nil and
- 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")
+ local mod_conf = Settings(prefix .. "mod.conf"):to_table()
+ if mod_conf.name then
+ name = mod_conf.name
end
- if modpackfile ~= nil then
- modpackfile:close()
- toadd.is_modpack = true
- table.insert(retval,toadd)
- get_mods(path .. DIR_DELIM .. mods[i],retval,mods[i])
+ toadd.name = name
+ toadd.path = prefix
+
+ if modpack ~= nil and modpack ~= "" then
+ toadd.modpack = modpack
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