Remove FileChooser:compressPath, use util.realpath

pull/238/head
Paulo Matias 11 years ago
parent 87655ffdec
commit 3d04925109

@ -15,20 +15,6 @@ function FileChooser:init()
Menu.init(self) -- call parent's init()
end
function FileChooser:compressPath(path)
local pos
if path:sub(1, 1) ~= "/" then
-- currently does not work with relative paths
return path
end
path = path:gsub("/+", "/")
-- compress paths like "test/pdf/../epub" into "test/epub"
repeat
path, pos = path:gsub("/?[^/]*/%.%.", "", 1)
until pos == 0
return path ~= "" and path or "/"
end
function FileChooser:genItemTableFromPath(path)
local dirs = {}
local files = {}
@ -64,7 +50,7 @@ function FileChooser:genItemTableFromPath(path)
end
function FileChooser:changeToPath(path)
path = self:compressPath(path)
path = util.realpath(path)
self.path = path
self:swithItemTable(nil, self:genItemTableFromPath(path))
end

@ -1 +1 @@
Subproject commit bc556f656b0a0f3ca211d7000ea99ec04d947494
Subproject commit 6f8eaead566351b3086bc7f368d57d590c1d3001
Loading…
Cancel
Save