compress paths like "test/pdf/../epub" into "test/epub" in FileChooser

This patch fixes Bug #107
pull/157/head
chrox 11 years ago
parent c8efeb3cc3
commit 6c4248251c

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