[gnome-builder] libide/foundry: resolve build system paths via config



commit c49141e4ef2c404fa5e5dba64c24f0c6bce0ea12
Author: Christian Hergert <chergert redhat com>
Date:   Thu Sep 29 17:52:47 2022 -0700

    libide/foundry: resolve build system paths via config

 src/libide/foundry/ide-build-system.c | 39 ++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 19 deletions(-)
---
diff --git a/src/libide/foundry/ide-build-system.c b/src/libide/foundry/ide-build-system.c
index 76cb20297..141077fe9 100644
--- a/src/libide/foundry/ide-build-system.c
+++ b/src/libide/foundry/ide-build-system.c
@@ -318,35 +318,36 @@ ide_build_system_default_init (IdeBuildSystemInterface *iface)
   g_object_interface_install_property (iface, properties [PROP_PROJECT_FILE]);
 }
 
-static gchar *
-ide_build_system_translate (IdeBuildSystem   *self,
-                            IdePipeline *pipeline,
-                            const gchar      *prefix,
-                            const gchar      *path)
+static char *
+ide_build_system_translate (IdeBuildSystem *self,
+                            IdePipeline    *pipeline,
+                            const char     *prefix,
+                            const char     *path)
 {
-  g_autofree gchar *freeme = NULL;
-  g_autofree gchar *translated_path = NULL;
-  g_autoptr(GFile) file = NULL;
-  g_autoptr(GFile) translated = NULL;
-  IdeRuntime *runtime;
+  IdeConfig *config;
 
   g_assert (IDE_IS_BUILD_SYSTEM (self));
   g_assert (!pipeline || IDE_IS_PIPELINE (pipeline));
   g_assert (prefix != NULL);
   g_assert (path != NULL);
 
-  if (NULL == pipeline ||
-      NULL == (runtime = ide_pipeline_get_runtime (pipeline)))
-    return g_strdup_printf ("%s%s", prefix, path);
+  if (pipeline && (config = ide_pipeline_get_config (pipeline)))
+    {
+      g_autofree char *freeme = NULL;
+      g_autoptr(GFile) file = NULL;
+      g_autoptr(GFile) translated = NULL;
+
+      if (!g_path_is_absolute (path))
+        path = freeme = ide_pipeline_build_builddir_path (pipeline, path, NULL);
 
-  if (!g_path_is_absolute (path))
-    path = freeme = ide_pipeline_build_builddir_path (pipeline, path, NULL);
+      file = g_file_new_for_path (path);
 
-  file = g_file_new_for_path (path);
-  translated = ide_runtime_translate_file (runtime, file);
-  translated_path = g_file_get_path (translated);
+      if ((translated = ide_config_translate_file (config, file)) &&
+          g_file_is_native (translated))
+        return g_strdup_printf ("%s%s", prefix, g_file_peek_path (translated));
+    }
 
-  return g_strdup_printf ("%s%s", prefix, translated_path);
+  return g_strdup_printf ("%s%s", prefix, path);
 }
 
 static void


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