[seed] add seed_importer_add_search_path()
- From: Alan Knowles <alank src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seed] add seed_importer_add_search_path()
- Date: Thu, 7 Feb 2013 08:45:31 +0000 (UTC)
commit ebe57fe1fdcff23e1d3f272da39ed49f0e074418
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Tue Jan 29 13:10:09 2013 +0100
add seed_importer_add_search_path()
https://bugzilla.gnome.org/show_bug.cgi?id=692794
libseed/seed-importer.c | 22 ++++++++++++++++++++++
libseed/seed.h | 2 +-
2 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/libseed/seed-importer.c b/libseed/seed-importer.c
index a69bf8e..de331ff 100644
--- a/libseed/seed-importer.c
+++ b/libseed/seed-importer.c
@@ -975,7 +975,29 @@ seed_importer_set_search_path (JSContextRef ctx, gchar ** search_path)
array = JSObjectMakeArray (ctx, length, array_elem, NULL);
seed_object_set_property (ctx, imports, "searchPath", array);
+}
+
+void
+seed_importer_add_search_path (JSContextRef ctx, gchar *search_path)
+{
+ GSList *paths, *l;
+ GPtrArray *tmp;
+
+ tmp = g_ptr_array_new ();
+
+ paths = seed_importer_get_search_path (ctx, NULL);
+ for (l = paths; l != NULL; l = g_slist_next (l))
+ {
+ g_ptr_array_add (tmp, l->data);
+ }
+
+ g_ptr_array_add (tmp, search_path);
+ g_ptr_array_add (tmp, NULL);
+
+ seed_importer_set_search_path (ctx, (gchar **) tmp->pdata);
+ g_ptr_array_unref (tmp);
+ seed_importer_free_search_path (paths);
}
JSClassDefinition importer_class_def = {
diff --git a/libseed/seed.h b/libseed/seed.h
index c722b95..0485f84 100644
--- a/libseed/seed.h
+++ b/libseed/seed.h
@@ -132,7 +132,7 @@ void seed_importer_add_global(SeedContext ctx, gchar *name);
void seed_importer_set_search_path (SeedContext ctx,
gchar **search_path);
void seed_prepare_global_context (SeedContext ctx);
-
+void seed_importer_add_search_path (SeedContext ctx, gchar *search_path);
SeedValue seed_make_null (SeedContext ctx);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]