libseed-list __script_path__ in sandbox contexts



I think ctx.add_globals() should copy the __script_path__ so that doing imports in the new context does the '.' replacement trick. (Otherwise '.' will be interpreted as current directory)

Something like this:

diff --git a/modules/sandbox/seed-sandbox.c b/modules/sandbox/seed-sandbox.c
index b33e57d..a1c80a6 100644
--- a/modules/sandbox/seed-sandbox.c
+++ b/modules/sandbox/seed-sandbox.c
@@ -84,6 +84,10 @@ seed_sandbox_context_add_globals (SeedContext ctx,
     }
   seed_prepare_global_context (c);

+  SeedObject g = seed_context_get_global_object (c);
+  SeedObject global = seed_context_get_global_object (ctx);
+ seed_object_set_property (c, g, "__script_path__", seed_object_get_property (ctx, global, "__script_path__"));
+
   return seed_make_null (ctx);
 }

/Jonatan


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