diff options
author | SmallJoker <mk939@ymail.com> | 2014-12-07 11:14:52 +0100 |
---|---|---|
committer | Craig Robbins <kde.psych@gmail.com> | 2014-12-10 02:49:02 +1000 |
commit | 5229a229a606b25c2f620ba2b276f453ce99df51 (patch) | |
tree | 1df1b5bf7004ec085a776162989d0e0067722654 /builtin/mainmenu/modmgr.lua | |
parent | c5f6f9f77ac1df4b223649fcaca9a66333aa8786 (diff) | |
download | minetest-5229a229a606b25c2f620ba2b276f453ce99df51.tar.gz minetest-5229a229a606b25c2f620ba2b276f453ce99df51.tar.bz2 minetest-5229a229a606b25c2f620ba2b276f453ce99df51.zip |
Ignore .name directories and files
Signed-off-by: Craig Robbins <kde.psych@gmail.com>
Diffstat (limited to 'builtin/mainmenu/modmgr.lua')
-rw-r--r-- | builtin/mainmenu/modmgr.lua | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/builtin/mainmenu/modmgr.lua b/builtin/mainmenu/modmgr.lua index dcd1eb256..f2938685e 100644 --- a/builtin/mainmenu/modmgr.lua +++ b/builtin/mainmenu/modmgr.lua @@ -17,30 +17,32 @@ -------------------------------------------------------------------------------- function get_mods(path,retval,modpack) + local mods = core.get_dirlist(path, true) + + for i=1, #mods, 1 do + if mods[i]:sub(1,1) ~= "." then + local toadd = {} + local modpackfile = nil + + 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") + end - local mods = core.get_dirlist(path,true) - for i=1,#mods,1 do - local toadd = {} - local modpackfile = nil - - 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") - 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]) - else - table.insert(retval,toadd) + if modpackfile ~= nil then + modpackfile:close() + toadd.is_modpack = true + table.insert(retval,toadd) + get_mods(path .. DIR_DELIM .. mods[i],retval,mods[i]) + else + table.insert(retval,toadd) + end end end end |