On Thu, May 10, 2012 at 11:24 PM, Jasper St. Pierre
<[email protected]> wrote:
> You want to use Gio.File nowadays. See listDirAsync in:
>    http://git.gnome.org/browse/gnome-shell/tree/js/misc/fileUtils.js

Thanks! I've sort of got it working.
How do I handle the whole asynchronous thing? My current code looks like:

let fileList = [];
let dir = Gio.file_new_for_path( '/path/to/the/directory' );
fileUtils.listDirAsync( dir,
                              function( fileinfos ) {
                                  fileList = fileinfos;
                              } );

If I perform this in the gnome looking glass, it works. When I do it
from gjs (whether the console or script), fileList is empty.

I assume I have to somehow wait for listDirAsync to finish its
business, or perhaps there is some scope problem? How can I simply get
the list of file infos found into fileList? (In the end I just want an
array of string paths).
_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to