Minor improvements to loveframes.util.GetDirecoryContents

This commit is contained in:
Kenny Shields 2014-08-10 15:11:30 -04:00
parent 98c47eb9f9
commit 7f8963b3e1

View File

@ -147,9 +147,11 @@ function loveframes.util.GetDirectoryContents(dir, t)
table.insert(dirs, dir.. "/" ..v) table.insert(dirs, dir.. "/" ..v)
else else
local parts = loveframes.util.SplitString(v, "([.])") local parts = loveframes.util.SplitString(v, "([.])")
local extension = parts[#parts] local extension = #parts > 1 and parts[#parts]
if #parts > 1 then
parts[#parts] = nil parts[#parts] = nil
local name = table.concat(parts) end
local name = table.concat(parts, ".")
table.insert(t, { table.insert(t, {
path = dir, path = dir,
fullpath = dir.. "/" ..v, fullpath = dir.. "/" ..v,
@ -160,11 +162,9 @@ function loveframes.util.GetDirectoryContents(dir, t)
end end
end end
if #dirs > 0 then
for k, v in ipairs(dirs) do for k, v in ipairs(dirs) do
t = loveframes.util.GetDirectoryContents(v, t) t = loveframes.util.GetDirectoryContents(v, t)
end end
end
return t return t