Re: Getting list of files in a directory with GLib

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

 



On Thu, May 10, 2012 at 9:09 AM, Amy C <mathematical.coffee@xxxxxxxxx> wrote:
> 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...

You want to use Gio.File nowadays. See listDirAsync in:

    http://git.gnome.org/browse/gnome-shell/tree/js/misc/fileUtils.js

> thanks!
> _______________________________________________
> gtk-list mailing list
> gtk-list@xxxxxxxxx
> http://mail.gnome.org/mailman/listinfo/gtk-list



-- 
  Jasper
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list



[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux