[gjs: 1/4] context: Don't prepend installed GjsPrivate search path if uninstalled




commit 1b763b17a1a041e009e02dda2881464414dae6d8
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Apr 25 17:04:16 2021 -0700

    context: Don't prepend installed GjsPrivate search path if uninstalled
    
    We should set GJS_USE_UNINSTALLED_FILES (as the tests do) when hacking on
    an uninstalled copy. Additionally, if this environment variable is set,
    then we should not add the installed typelib location to the search path.
    
    Otherwise this can lead to the confusing situation, if you are modifying
    GjsPrivate, that an out-of-date installed typelib file can take precedence
    over the one in the build directory, even when running the tests.

 doc/Hacking.md  | 2 +-
 gjs/context.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/doc/Hacking.md b/doc/Hacking.md
index 3c2d3e5b..7146e64b 100644
--- a/doc/Hacking.md
+++ b/doc/Hacking.md
@@ -76,7 +76,7 @@ For a list of available options, run `meson configure`.
 That's it! You can now run your build of gjs for testing and hacking with
 
 ```sh
-LD_LIBRARY_PATH=_build GI_TYPELIB_PATH=_build ./_build/gjs-console script.js
+LD_LIBRARY_PATH=_build GI_TYPELIB_PATH=_build GJS_USE_UNINSTALLED_FILES=1 ./_build/gjs-console script.js
 ```
 
 To install GJS into the path you chose with `-Dprefix`, (or into
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 532bf6d9..9eab2939 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -303,7 +303,7 @@ gjs_context_class_init(GjsContextClass *klass)
     g_param_spec_unref(pspec);
 
     /* For GjsPrivate */
-    {
+    if (!g_getenv("GJS_USE_UNINSTALLED_FILES")) {
 #ifdef G_OS_WIN32
         extern HMODULE gjs_dll;
         char *basedir = g_win32_get_package_installation_directory_of_module (gjs_dll);


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