1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Ignore .name directories and files

Signed-off-by: Craig Robbins <kde.psych@gmail.com>
This commit is contained in:
SmallJoker 2014-12-07 11:14:52 +01:00 committed by Craig Robbins
parent c5f6f9f77a
commit 5229a229a6
3 changed files with 76 additions and 81 deletions

View file

@ -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
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
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