Merge pull request #157 from chrox/path_compress

compress paths like "test/pdf/../epub" into "test/epub" in FileChooser
pull/158/head
{Qingping,Dave} Hou 11 years ago
commit bb62d0c5e2

@ -13,7 +13,17 @@ function FileChooser:init()
self:changeToPath(self.path)
end
function FileChooser:compressPath(item_path)
-- compress paths like "test/pdf/../epub" into "test/epub"
local path = item_path
while path:match("/[^/]+[/][\\.][\\.]") do
path = path:gsub("/[^/]+[/][\\.][\\.]", "")
end
return path
end
function FileChooser:changeToPath(path)
path = self:compressPath(path)
local dirs = {}
local files = {}
self.path = path

Loading…
Cancel
Save