[gnome-builder] gjs: improve gjs discovery and use srcdir for cwd



commit 30949a0647f5f546bec252cb4430aa245cd93c45
Author: Christian Hergert <chergert redhat com>
Date:   Sat Jan 1 11:09:10 2022 -0800

    gjs: improve gjs discovery and use srcdir for cwd

 src/plugins/gjs-symbols/gjs_symbols.py | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/gjs-symbols/gjs_symbols.py b/src/plugins/gjs-symbols/gjs_symbols.py
index e8998def2..e06353f3c 100644
--- a/src/plugins/gjs-symbols/gjs_symbols.py
+++ b/src/plugins/gjs-symbols/gjs_symbols.py
@@ -266,13 +266,19 @@ class GjsSymbolProvider(Ide.Object, Ide.SymbolResolver):
         file_path = file_.get_path()
         script = JS_SCRIPT % file_path.replace('\\', '\\\\').replace("'", "\\'")
         unsaved_file = Ide.UnsavedFiles.from_context(context).get_unsaved_file(file_)
+        srcdir = context.ref_workdir().get_path()
+        launcher = None
 
         if context.has_project():
-            runtime = Ide.ConfigManager.from_context(context).get_current().get_runtime()
-            launcher = runtime.create_launcher()
-        else:
+            pipeline = Ide.BuildManager.from_context(context).get_pipeline()
+            if pipeline is not None and pipeline.contains_program_in_path('gjs'):
+                launcher = pipeline.create_launcher()
+                srcdir = pipeline.get_srcdir()
+
+        if launcher is None:
             launcher = Ide.SubprocessLauncher.new(0)
 
+        launcher.set_cwd(srcdir)
         launcher.set_flags(Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_SILENCE)
         launcher.push_args(('gjs', '-c', script))
 


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