From 7f8963b3e1f2d603bc352eb08c9cfd13bd34232e Mon Sep 17 00:00:00 2001 From: Kenny Shields Date: Sun, 10 Aug 2014 15:11:30 -0400 Subject: [PATCH] Minor improvements to loveframes.util.GetDirecoryContents --- libraries/util.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/util.lua b/libraries/util.lua index 2ce685e..e87538a 100644 --- a/libraries/util.lua +++ b/libraries/util.lua @@ -147,9 +147,11 @@ function loveframes.util.GetDirectoryContents(dir, t) table.insert(dirs, dir.. "/" ..v) else local parts = loveframes.util.SplitString(v, "([.])") - local extension = parts[#parts] - parts[#parts] = nil - local name = table.concat(parts) + local extension = #parts > 1 and parts[#parts] + if #parts > 1 then + parts[#parts] = nil + end + local name = table.concat(parts, ".") table.insert(t, { path = dir, fullpath = dir.. "/" ..v, @@ -160,10 +162,8 @@ function loveframes.util.GetDirectoryContents(dir, t) end end - if #dirs > 0 then - for k, v in ipairs(dirs) do - t = loveframes.util.GetDirectoryContents(v, t) - end + for k, v in ipairs(dirs) do + t = loveframes.util.GetDirectoryContents(v, t) end return t