Getting list of files in a directory with GLib



Hi all,

I have a GLib question to ask. I hope it is OK to ask it here (the
developer.gnome.org page on GLib
(http://developer.gnome.org/glib/2.30/glib-resources.html) says that
GLib-related questions would be appropriate for this list, but if
there is a specific GLib mailing list I'm hapy to be redirected).

All I want to do is list all files within a directory (well, with some
pattern matching, but that can come later).

However, I am using the gjs (GNOME javascript) bindings which are
restricted by what is exposed through the gobject introspection
interface.

I believe that g_dir_open and g_dir_read_name etc are the functions I
need to iterate through entries in a directory, but I can't work out
how to access these from the javascript side. There is a
imports.gi.GLib and imports.gi.GLib.Dir, but as far as I can tell the
GLib.Dir object is empty? GLib.Dir.read_name and GLib.Dir.open do not
exist.

Also, I had a quick look at the .gir file for GLib and noticed that
(for example) the g_dir_read_name has 'introspectable="0"' in it,
meaning I can't access it (?).

In this case, what are my alternatives? It seems like such a simple task...

thanks!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]