[gnome-builder/wip/chergert/pipeline-merge] flatpak: Sanitize runtime_id for use in dir names



commit 940282b4a2b46fea3cb28029ce0538e4dfe3615c
Author: Matthew Leeds <mleeds redhat com>
Date:   Mon Feb 6 16:47:10 2017 -0600

    flatpak: Sanitize runtime_id for use in dir names
    
    We don't want slashes in the runtime id affecting the build directories
    being used.

 plugins/flatpak/gbp-flatpak-util.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-util.c b/plugins/flatpak/gbp-flatpak-util.c
index c67a1bd..6203f8b 100644
--- a/plugins/flatpak/gbp-flatpak-util.c
+++ b/plugins/flatpak/gbp-flatpak-util.c
@@ -23,18 +23,20 @@
 gchar *
 gbp_flatpak_get_repo_dir (IdeConfiguration *configuration)
 {
+  g_autofree gchar *runtime_id = NULL;
   const gchar *project_id;
-  const gchar *runtime_id;
   IdeContext *context;
   IdeProject *project;
 
   g_assert (IDE_IS_CONFIGURATION (configuration));
 
-  runtime_id = ide_configuration_get_runtime_id (configuration);
+  runtime_id = g_strdup (ide_configuration_get_runtime_id (configuration));
   context = ide_object_get_context (IDE_OBJECT (configuration));
   project = ide_context_get_project (context);
   project_id = ide_project_get_id (project);
 
+  g_strdelimit (runtime_id, G_DIR_SEPARATOR_S, '-');
+
   return g_build_filename (g_get_user_cache_dir (),
                            "gnome-builder",
                            "flatpak",
@@ -47,18 +49,20 @@ gbp_flatpak_get_repo_dir (IdeConfiguration *configuration)
 gchar *
 gbp_flatpak_get_staging_dir (IdeConfiguration *configuration)
 {
+  g_autofree gchar *runtime_id = NULL;
   const gchar *project_id;
-  const gchar *runtime_id;
   IdeContext *context;
   IdeProject *project;
 
   g_assert (IDE_IS_CONFIGURATION (configuration));
 
-  runtime_id = ide_configuration_get_runtime_id (configuration);
+  runtime_id = g_strdup (ide_configuration_get_runtime_id (configuration));
   context = ide_object_get_context (IDE_OBJECT (configuration));
   project = ide_context_get_project (context);
   project_id = ide_project_get_id (project);
 
+  g_strdelimit (runtime_id, G_DIR_SEPARATOR_S, '-');
+
   return g_build_filename (g_get_user_cache_dir (),
                            "gnome-builder",
                            "flatpak",


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