[gnome-builder] libide/core: normalize path suffixes



commit 6947a03943ae93037ce47ac8aca62e4efaaf75a3
Author: Christian Hergert <chergert redhat com>
Date:   Wed Aug 24 16:04:45 2022 -0700

    libide/core: normalize path suffixes
    
    This allows binding a value like "json" and having it suffixed like "json/"
    which is useful from tweaks bindings.

 src/libide/core/ide-settings.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/core/ide-settings.c b/src/libide/core/ide-settings.c
index 56323fc24..67a54d1b0 100644
--- a/src/libide/core/ide-settings.c
+++ b/src/libide/core/ide-settings.c
@@ -123,10 +123,14 @@ ide_settings_resolve_schema_path (const char *schema_id,
 {
   g_autoptr(GSettingsSchema) schema = NULL;
   GSettingsSchemaSource *source;
+  g_autofree char *real_path_suffix = NULL;
   const char *schema_path;
 
   g_return_val_if_fail (schema_id != NULL, NULL);
-  g_return_val_if_fail (!path_suffix || g_str_has_suffix (path_suffix, "/"), NULL);
+
+  /* Normalize our path suffix if we were provided one */
+  if (path_suffix != NULL && !g_str_has_suffix (path_suffix, "/"))
+    path_suffix = real_path_suffix = g_strconcat (path_suffix, "/", NULL);
 
   source = g_settings_schema_source_get_default ();
 


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