aboutsummaryrefslogtreecommitdiff
path: root/core/ext/pm/file_browser.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-02-05 00:29:22 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2009-02-05 00:29:22 -0500
commitda7eea23c7060f609c8636de6b0d64f13d7c2674 (patch)
tree757de08bd163056ac62a8bcbec45dcb087a49c9c /core/ext/pm/file_browser.lua
parent65fecf117e5187750e3f633420a4f7cd86dfaad3 (diff)
downloadtextadept-da7eea23c7060f609c8636de6b0d64f13d7c2674.tar.gz
textadept-da7eea23c7060f609c8636de6b0d64f13d7c2674.zip
Respond to GtkComboBoxEntry's "changed" event with PM entry activation.
Since every keypress causes "changed" to fire, the file browser should only populate the PM view if the current filepath is a valid directory.
Diffstat (limited to 'core/ext/pm/file_browser.lua')
-rw-r--r--core/ext/pm/file_browser.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/core/ext/pm/file_browser.lua b/core/ext/pm/file_browser.lua
index ad70f75b..8aa6cf96 100644
--- a/core/ext/pm/file_browser.lua
+++ b/core/ext/pm/file_browser.lua
@@ -24,12 +24,15 @@ end
function get_contents_for(full_path)
local dir = {}
local dirpath = table.concat(full_path, '/')
- for name in lfs.dir(dirpath) do
- if not name:find('^%.') then
- dir[name] = { text = name }
- if lfs.attributes(dirpath..'/'..name, 'mode') == 'directory' then
- dir[name].parent = true
- dir[name].pixbuf = 'gtk-directory'
+ local path = lfs.attributes(dirpath)
+ if path and path.mode == 'directory' then
+ for name in lfs.dir(dirpath) do
+ if not name:find('^%.') then
+ dir[name] = { text = name }
+ if lfs.attributes(dirpath..'/'..name, 'mode') == 'directory' then
+ dir[name].parent = true
+ dir[name].pixbuf = 'gtk-directory'
+ end
end
end
end