[gjs] importer: Add back the ability for others to install overrides



commit b2d6aa0607116fb87f43fddd5ac66232a7549532
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Aug 24 09:15:18 2014 -0400

    importer: Add back the ability for others to install overrides
    
    Some third-party libraries rely on the ability to install the overrides,
    so let's let them.

 Makefile.am      |    4 ++++
 gjs/importer.cpp |   12 +++++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index e1fc388..4dbd318 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,6 +18,9 @@ ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
 AM_CFLAGS = $(WARN_CFLAGS) -DG_LOG_DOMAIN=\"Gjs\"
 AM_CPPFLAGS = $(WARN_CXXFLAGS) -DG_LOG_DOMAIN=\"Gjs\"
 
+gjsjsdir = @gjsjsdir@
+gjsoverridedir = $(gjsjsdir)/overrides
+
 gjs_public_includedir = $(includedir)/gjs-1.0
 gjs_module_includedir = $(includedir)/gjs-1.0
 
@@ -77,6 +80,7 @@ EXTRA_DIST +=                         \
 ########################################################################
 gjs_directory_defines =                                \
        -DGJS_TOP_SRCDIR=\"$(top_srcdir)\"              \
+       -DGJS_JS_DIR=\"$(gjsjsdir)\"                    \
        -DPKGLIBDIR=\"$(pkglibdir)\"
 
 ########################################################################
diff --git a/gjs/importer.cpp b/gjs/importer.cpp
index f4ab160..fa84b01 100644
--- a/gjs/importer.cpp
+++ b/gjs/importer.cpp
@@ -1024,9 +1024,19 @@ gjs_get_search_path(void)
             g_free(dirs);
         }
 
-        /* ${datadir}/share/gjs-1.0 */
         g_ptr_array_add(path, g_strdup("resource:///org/gnome/gjs/modules/"));
 
+        /* $XDG_DATA_DIRS /gjs-1.0 */
+        system_data_dirs = g_get_system_data_dirs();
+        for (i = 0; system_data_dirs[i] != NULL; ++i) {
+            char *s;
+            s = g_build_filename(system_data_dirs[i], "gjs-1.0", NULL);
+            g_ptr_array_add(path, s);
+        }
+
+        /* ${datadir}/share/gjs-1.0 */
+        g_ptr_array_add(path, g_strdup(GJS_JS_DIR));
+
         g_ptr_array_add(path, NULL);
 
         search_path = (char**)g_ptr_array_free(path, FALSE);


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