[gnome-builder] makecache: use IdeRuntime to translate include paths



commit 20d1ffb38b9f2d7bfb91abd0b59c474d0971fd7a
Author: Christian Hergert <chergert redhat com>
Date:   Tue Dec 13 17:18:32 2016 -0800

    makecache: use IdeRuntime to translate include paths
    
    When generating our translated include paths, we need to access the paths
    from how they exist in the runtime to paths we can reach from outside the
    runtime. This relies on the runtime to provide access to the raw underlying
    file on the host system.

 plugins/autotools/ide-makecache.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/plugins/autotools/ide-makecache.c b/plugins/autotools/ide-makecache.c
index bb59fda..eaaa872 100644
--- a/plugins/autotools/ide-makecache.c
+++ b/plugins/autotools/ide-makecache.c
@@ -639,7 +639,10 @@ ide_makecache_parse_c_cxx_include (IdeMakecache *self,
                                    const gchar  *subdir)
 {
   static const gchar *dummy = "-I";
-  gchar *adjusted = NULL;
+  g_autofree gchar *adjusted = NULL;
+  g_autoptr(GFile) file = NULL;
+  g_autoptr(GFile) translated = NULL;
+  g_autofree gchar *translated_path = NULL;
 
   g_assert (self != NULL);
   g_assert (ret != NULL);
@@ -680,9 +683,14 @@ ide_makecache_parse_c_cxx_include (IdeMakecache *self,
       part2 = adjusted;
     }
 
-  g_ptr_array_add (ret, g_strdup_printf ("%s%s", part1, part2));
+  file = g_file_new_for_path (part2);
+  translated = ide_runtime_translate_file (self->runtime, file);
+  translated_path = g_file_get_path (translated);
+
+  if (translated_path != NULL)
+    part2 = translated_path;
 
-  g_free (adjusted);
+  g_ptr_array_add (ret, g_strdup_printf ("%s%s", part1, part2));
 }
 
 static void


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