Re: libseed-list something broke with upgrade

With some more debug printing, it seems that Seed.include(fn) doesn't evaluate the included script in the same context!

lijon kymatix:~/Coding/seed$ seed foo.js
*** running defaults_script in seed_init ctx 0xb604ae24
*** seed_include /usr/local/share/seed/extensions/Seed.js on ctx 0xb5c160a0
Running Seed.js
setting searchPath..
Setting __script_path__
*** seed exec js file on ctx 0xb604ae24

** (seed:22492): CRITICAL **: Line 2 in foo.js: ReferenceError Can't find variable: __script_path__

If you compare the ctx pointers, the context in seed_include() is not the same as the one executing foo.js and running defaults_script (Seed.include("extensions/Seed.js")), but it should - or else any variables declared in the included file will not be "exported".

BTW, a cleaner way to run Seed.js than to eval a script with "Seed.include(...)" would IMHO be something like this:

  seed_evaluate (eng->context,
                 seed_script_new_from_file (eng->context,
                    SEED_PREFIX_PATH "extensions/Seed.js"),

Trying this in seed_init_with_context_and_group() didn't help though.

Any ideas?


On 07/13/2010 06:25 PM, Jonatan Liljedahl wrote:
I just recompiled Seed from current git, after upgrading to ubuntu 10.04
and upgrading some gobject-introspection stuff to be able to compile the
latest Seed.

It built fine, but something happened with import.searchPath. With this

// foo.js
// EOF

and a modified extensions/Seed.js with debug-prints like this:

print("Running Seed.js");
if(!imports.searchPath || (imports.searchPath.length == 0))
print("setting searchPath..");
imports.searchPath = [ "/usr/share/gnome-js",
"/usr/share/seed" ];

if(Seed.argv.length > 1)
print("Setting __script_path__");
__script_path__ = GLib.path_get_dirname(Seed.argv[1]);

I get this output when running 'seed foo.js':

Running Seed.js
setting searchPath..
Setting __script_path__

** (seed:19398): CRITICAL **: Line 2 in foo.js: ReferenceError Can't
find variable: __script_path__

As you see, __script_path__ didn't stick and '.' didn't get added to
Also I noticed that the 'GLib' variable is no longer automatically
available in new contexts as it used to be (since Seed.js exports it as
a toplevel variable). What's going on? This situation breaks the import

libseed-list mailing list
libseed-list gnome org

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