[gimp] app: expand/unexpand locale paths in pluginrc.



commit 0fce8fdb3c056acead8322c976a96fb6fba793b6
Author: Jehan <jehan girinstud io>
Date:   Sun Apr 29 02:20:58 2018 +0200

    app: expand/unexpand locale paths in pluginrc.
    
    It doesn't look like it is actually much of a problem, but anyway it's
    better to have non-absolute paths in config files when possible.
    
    Thanks to jtojnar on IRC for reporting these (and MyPaint brush paths
    from my previous commit).

 app/plug-in/plug-in-rc.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/app/plug-in/plug-in-rc.c b/app/plug-in/plug-in-rc.c
index 9e7e3ae..81ead35 100644
--- a/app/plug-in/plug-in-rc.c
+++ b/app/plug-in/plug-in-rc.c
@@ -732,18 +732,20 @@ plug_in_locale_def_deserialize (GScanner      *scanner,
                                 GimpPlugInDef *plug_in_def)
 {
   gchar *domain_name;
-  gchar *domain_path;
+  gchar *domain_path   = NULL;
+  gchar *expanded_path = NULL;
 
   if (! gimp_scanner_parse_string (scanner, &domain_name))
     return G_TOKEN_STRING;
 
-  if (! gimp_scanner_parse_string (scanner, &domain_path))
-    domain_path = NULL;
+  if (gimp_scanner_parse_string (scanner, &domain_path))
+    expanded_path = gimp_config_path_expand (domain_path, TRUE, NULL);
 
-  gimp_plug_in_def_set_locale_domain (plug_in_def, domain_name, domain_path);
+  gimp_plug_in_def_set_locale_domain (plug_in_def, domain_name, expanded_path);
 
   g_free (domain_name);
   g_free (domain_path);
+  g_free (expanded_path);
 
   if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
     return G_TOKEN_RIGHT_PAREN;
@@ -1007,8 +1009,15 @@ plug_in_rc_write (GSList  *plug_in_defs,
                                          plug_in_def->locale_domain_name);
 
               if (plug_in_def->locale_domain_path)
-                gimp_config_writer_string (writer,
-                                           plug_in_def->locale_domain_path);
+                {
+                  path = gimp_config_path_unexpand (plug_in_def->locale_domain_path,
+                                                    TRUE, NULL);
+                  if (path)
+                    {
+                      gimp_config_writer_string (writer, path);
+                      g_free (path);
+                    }
+                }
 
               gimp_config_writer_close (writer);
             }


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