From 749c7f993952ca04a2a8696b1d7628025ebf4195 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Mon, 25 Aug 2014 00:20:19 -0400 Subject: [PATCH] fix(FM): remove redundant call to lfs.dir --- frontend/ui/widget/filechooser.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/ui/widget/filechooser.lua b/frontend/ui/widget/filechooser.lua index 3a6cf245e..65abac827 100644 --- a/frontend/ui/widget/filechooser.lua +++ b/frontend/ui/widget/filechooser.lua @@ -39,8 +39,9 @@ function FileChooser:genItemTableFromPath(path) local files = {} -- lfs.dir directory without permission will give error - if pcall(lfs.dir, self.path) then - for f in lfs.dir(self.path) do + local ok, iter, dir_obj = pcall(lfs.dir, self.path) + if ok then + for f in iter, dir_obj do if self.show_hidden or not string.match(f, "^%.[^.]") then local filename = self.path.."/"..f local filemode = lfs.attributes(filename, "mode")