Allow Nautilus to search for extensions in the directories listed in $NAUTILUS_EXTENSION_PATH. Index: nautilus-44.2/src/nautilus-module.c =================================================================== --- nautilus-44.2.orig/src/nautilus-module.c +++ nautilus-44.2/src/nautilus-module.c @@ -220,8 +220,16 @@ static void load_module_dir (const char *dirname) { GDir *dir; - + static GHashTable *loaded = NULL; g_autoptr (GStrvBuilder) installed_module_name_builder = g_strv_builder_new (); + + if (installed_module_names != NULL) + g_strv_builder_addv (installed_module_name_builder, + (const gchar **)installed_module_names); + + if (loaded == NULL) + loaded = g_hash_table_new (g_str_hash, g_str_equal); + dir = g_dir_open (dirname, 0, NULL); if (dir) @@ -232,16 +240,24 @@ load_module_dir (const char *dirname) { if (g_str_has_suffix (name, "." G_MODULE_SUFFIX)) { - char *filename; - - filename = g_build_filename (dirname, - name, - NULL); - nautilus_module_load_file (filename, installed_module_name_builder); - g_free (filename); + /* Make sure each module is loaded only twice or this could + lead to a crash. Double loading can occur if DIRNAME + occurs more than once in $NAUTILUS_EXTENSION_PATH. */ + if (!g_hash_table_contains (loaded, name)) + { + char *filename; + + filename = g_build_filename (dirname, + name, + NULL); + nautilus_module_load_file (filename, + installed_module_name_builder); + g_hash_table_add (loaded, g_strdup (name)); + g_free (filename); + } } - } + } g_dir_close (dir); } @@ -278,10 +294,24 @@ nautilus_module_setup (void) if (!initialized) { + const gchar *extension_path; initialized = TRUE; load_module_dir (NAUTILUS_EXTENSIONDIR); + /* Load additional modules from the user-provided search path. */ + extension_path = g_getenv ("NAUTILUS_EXTENSION_PATH"); + if (extension_path) + { + char **extension_dirs, **d; + + extension_dirs = g_strsplit (extension_path, ":", -1); + for (d = extension_dirs; d != NULL && *d != NULL; d++) + load_module_dir (*d); + + g_strfreev (extension_dirs); + } + eel_debug_call_at_shutdown (free_module_objects); } } d-and-use-profile'. * guix/scripts/system.scm (maybe-suggest-running-guix-pull)[latest]: Switch to "/current". * scripts/guix.in (augment-load-paths!): Remove use of ~/.config/guix/latest. * build-aux/compile-as-derivation.scm: Replace "/guix/latest/" with "/current/share/guile/site/X.Y" * guix/scripts.scm (warn-about-old-distro)[age]: Check "/current" instead of "/latest". * doc/guix.texi (Invoking guix pull): Document it. * doc/contributing.texi (Running Guix Before It Is Installed): Remove footnote about abusing ~/.config/guix/latest. Ludovic Courtès 2018-01-28guix: Let Emacs detect “scripts/guix.in” appropriate mode....Since commit 6f774d481839f87178c5895ac2d661e141f879b8 which introduces the use of Guile's meta switch in “scripts/guix.in”, Emacs was not using ‘scheme-mode’ for this file. * scripts/guix.in: Replace "-*- scheme -*-" with a local variable. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Mathieu Lirzin 2018-01-23guix: Refactor script....* scripts/guix.in: Remove empty surrounding ‘let’. Define 'main' as the procedure called when running the script. (maybe-augment-load-paths!): Rename to ... (augment-load-paths!): ... this. Use 'and=>' for 'file-exists?'. (run-guix-main): Rename to ... (main): ... this. Call 'augment-load-paths!'. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Mathieu Lirzin 2018-01-23build: Expand ‘scripts/guix’ at Make time....This moves the complexity of Autotools variable expansion outside of the application code. * scripts/guix.in (config-lookup): Delete. (maybe-augment-load-paths!, run-guix-main): Use fully expanded variables instead of calling ‘config-lookup’. * configure.ac: Don't use AC_CONFIG_FILES for ‘scripts/guix’. Use AC_PROG_SED. * Makefile.am (scripts/guix): New rule. (do_subst): New variable. (CLEANFILES, EXTRA_DIST): Adapt. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Mathieu Lirzin 2017-03-20build: Install .go files to $libdir/guile/X.Y....* configure.ac: Define and substitute 'guileobjectdir'. * Makefile.am (nobase_nodist_guilemodule_DATA): Remove $(GOBJECTS). (nobase_nodist_guileobject_DATA): New variable. (guix_install_go_files): Adjust accordingly. (install-data-hook): Likewise. * scripts/guix.in (config-lookup): Add 'exec_prefix' and 'guileobjectdir'. Add '_' in VAR-REF-REGEXP. (maybe-augment-load-paths!): Distinguish OBJECT-DIR from MODULE-DIR. Ludovic Courtès