[gnome-builder] pipeline: handle relative paths from $builddir



commit aea2e4035d3feb3935c179549627dd4cfb41f81a
Author: Christian Hergert <chergert redhat com>
Date:   Fri Mar 24 22:02:49 2017 -0700

    pipeline: handle relative paths from $builddir
    
    If we get an error and there is no discovered "current directory", we can
    just use the builddir as the relative path to the file. This fixes ninja
    output from meson for vala warnings.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780467

 libide/buildsystem/ide-build-pipeline.c |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/libide/buildsystem/ide-build-pipeline.c b/libide/buildsystem/ide-build-pipeline.c
index e109323..4d56ca4 100644
--- a/libide/buildsystem/ide-build-pipeline.c
+++ b/libide/buildsystem/ide-build-pipeline.c
@@ -424,21 +424,31 @@ create_diagnostic (IdeBuildPipeline *self,
 
   parsed.severity = parse_severity (level);
 
-  if (!g_path_is_absolute (filename) && self->errfmt_current_dir != NULL)
+  if (!g_path_is_absolute (filename))
     {
-      const gchar *basedir = self->errfmt_current_dir;
       gchar *path;
 
-      if (g_str_has_prefix (basedir, self->errfmt_top_dir))
+      if (self->errfmt_current_dir != NULL)
         {
-          basedir += strlen (self->errfmt_top_dir);
-          if (*basedir == G_DIR_SEPARATOR)
-            basedir++;
-        }
+          const gchar *basedir = self->errfmt_current_dir;
 
-      path = g_build_filename (basedir, filename, NULL);
-      g_free (filename);
-      filename = path;
+          if (g_str_has_prefix (basedir, self->errfmt_top_dir))
+            {
+              basedir += strlen (self->errfmt_top_dir);
+              if (*basedir == G_DIR_SEPARATOR)
+                basedir++;
+            }
+
+          path = g_build_filename (basedir, filename, NULL);
+          g_free (filename);
+          filename = path;
+        }
+      else
+        {
+          path = g_build_filename (self->builddir, filename, NULL);
+          g_free (filename);
+          filename = path;
+        }
     }
 
   context = ide_object_get_context (IDE_OBJECT (self));


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