From 4d414f4d8c9e75e89a9ed99edc24d9cb305efcca Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 19 Nov 2010 07:53:51 +0800 Subject: [PATCH] Introspect/NameSpace.js --- Introspect/NameSpace.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/Introspect/NameSpace.js b/Introspect/NameSpace.js index 0d92b75..fa0691d 100644 --- a/Introspect/NameSpace.js +++ b/Introspect/NameSpace.js @@ -27,29 +27,20 @@ NameSpace = { if (!GLib.file_test(dir, GLib.FileTest.EXISTS)) { return; } - File.list(dir) - - while (true) { - - var fn = gdir.read_name ? gdir.read_name () : GLib.dir_read_name(gdir); - // console.log('trying ' + fn); - if (!fn) { - gdir.close ? gdir.close() : GLib.dir_close(gdir); - return;; - } + File.list(dir).forEach(function(fn) + { if (!fn.match(/.typelib$/)) { - continue; + return; } var par = fn.split('-').shift(); //console.log('trying ' + par); if (ret.indexOf(par) > -1) { - continue; + return; } ret.push(par); - - - } + }); } + var gi = GI.Repository.get_default(); var pth = GI.Repository.get_search_path (); -- 2.39.2