[gnome-builder] foundry: expand ~/ filenames from error messages



commit 348c76ebb86b82439969d38ebbeda9c300988f33
Author: Christian Hergert <chergert redhat com>
Date:   Tue Mar 26 11:41:55 2019 -0700

    foundry: expand ~/ filenames from error messages
    
    If for some reason we get an error message that starts with ~/, we should
    try to expand it. We only do this for the current user, not for other users
    (such as ~other).

 src/libide/foundry/ide-pipeline.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/src/libide/foundry/ide-pipeline.c b/src/libide/foundry/ide-pipeline.c
index 85100c45e..4864269a0 100644
--- a/src/libide/foundry/ide-pipeline.c
+++ b/src/libide/foundry/ide-pipeline.c
@@ -559,6 +559,14 @@ create_diagnostic (IdePipeline *self,
 
   parsed.severity = parse_severity (level);
 
+  /* Expand local user only, if we get a home-relative path */
+  if (filename != NULL && strncmp (filename, "~/", 2) == 0)
+    {
+      gchar *expanded = ide_path_expand (filename);
+      g_free (filename);
+      filename = expanded;
+    }
+
   if (!g_path_is_absolute (filename))
     {
       gchar *path;


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