[gnome-builder] host: translate /etc paths



commit fa284177a604ff6442c9951b0ccf23c3900c398b
Author: Christian Hergert <chergert redhat com>
Date:   Fri Nov 24 14:27:46 2017 -0800

    host: translate /etc paths
    
    We also get /etc from the flatpak --filesystem=host option, and so we
    might as well translate that too.

 src/libide/runtimes/ide-runtime.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/libide/runtimes/ide-runtime.c b/src/libide/runtimes/ide-runtime.c
index fdf8c89..41f20de 100644
--- a/src/libide/runtimes/ide-runtime.c
+++ b/src/libide/runtimes/ide-runtime.c
@@ -247,12 +247,12 @@ ide_runtime_real_translate_file (IdeRuntime *self,
   if (!g_file_is_native (file) || NULL == (path = g_file_get_path (file)))
     return NULL;
 
-  /* If this is /usr, then translate to /run/host/usr */
-  if (g_str_has_prefix (path, "/usr/"))
-    {
-      const gchar *suffix = path + strlen ("/usr/");
-      return g_file_new_build_filename ("/run/host/usr", suffix, NULL);
-    }
+  /* If this is /usr or /etc, then translate to /run/host/$dir,
+   * as that is where flatpak 0.10.1 and greater will mount them
+   * when --filesystem=host.
+   */
+  if (g_str_has_prefix (path, "/usr/") || g_str_has_prefix (path, "/etc/"))
+    return g_file_new_build_filename ("/run/host/", path, NULL);
 
   return NULL;
 }


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