hide certain directories in FileManager

The exclude pattern should be editable by users in the future.
pull/2/merge
chrox 11 years ago
parent f542ffbf57
commit 905b315c81

@ -22,9 +22,11 @@ function FileChooser:changeToPath(path)
local filename = self.path.."/"..f
local filemode = lfs.attributes(filename, "mode")
if filemode == "directory" and f ~= "." and f~=".." then
table.insert(dirs, f)
if self.dir_filter(filename) then
table.insert(dirs, f)
end
elseif filemode == "file" then
if self.filter(filename) then
if self.file_filter(filename) then
table.insert(files, f)
end
end

@ -78,6 +78,7 @@ function showReader(file, pass)
end
function showHomePage(path)
local exclude_dirs = {"%.sdr$"}
local FileManager = FileChooser:new{
title = "FileManager",
path = path,
@ -85,7 +86,13 @@ function showHomePage(path)
height = Screen:getHeight(),
is_borderless = true,
has_close_button = false,
filter = function(filename)
dir_filter = function(dirname)
for _, pattern in ipairs(exclude_dirs) do
if dirname:match(pattern) then return end
end
return true
end,
file_filter = function(filename)
if DocumentRegistry:getProvider(filename) then
return true
end

Loading…
Cancel
Save