[seed] imports['somedir/somefile.js'] works now
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [seed] imports['somedir/somefile.js'] works now
- Date: Sat, 6 Feb 2010 02:12:29 +0000 (UTC)
commit e29a3aca80d3e7d1095a093e2778ce6433aa9b0e
Author: Alan Knowles <alan akbkhome com>
Date: Fri Feb 5 21:10:58 2010 -0500
imports['somedir/somefile.js'] works now
Closes BGO#607987
libseed/seed-importer.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/libseed/seed-importer.c b/libseed/seed-importer.c
index 8aa193a..1f51838 100644
--- a/libseed/seed-importer.c
+++ b/libseed/seed-importer.c
@@ -723,7 +723,7 @@ seed_importer_search (JSContextRef ctx, gchar * prop, JSValueRef * exception)
GDir *dir;
GError *e;
- gchar *mentry;
+ gchar *mentry, *file_path, *file_basename, *file_dirname;
GSList *path, *walk;
JSObjectRef ret;
gchar *prop_as_lib =
@@ -746,6 +746,22 @@ seed_importer_search (JSContextRef ctx, gchar * prop, JSValueRef * exception)
walk = walk->next;
continue;
}
+ // try as as string first - eg. imports['xxxx.js']
+ file_path = g_build_filename ((gchar *) walk->data, prop, NULL);
+ // we could check first here if file already has been loaded
+ // skipping another state (see importer above..)
+
+ if (g_file_test (file_path, G_FILE_TEST_IS_REGULAR))
+ {
+ file_dirname = g_path_get_dirname(file_path);
+ file_basename = g_path_get_basename(file_path);
+ ret = seed_importer_handle_file ( ctx, file_dirname, file_basename, exception);
+ g_free (file_path);
+ g_free (file_basename);
+ g_free (file_dirname);
+ return ret;
+ }
+ g_free (file_path);
while ((entry = g_dir_read_name (dir)))
{
mentry = g_strdup (entry);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]