[gimp] app: use gimp_config_path_unexpand() when writing pluginrc



commit 12ac114f71d5e7e00897f0de8c6200bf5729d6d7
Author: Michael Natterer <mitch gimp org>
Date:   Thu Sep 1 00:44:19 2016 +0200

    app: use gimp_config_path_unexpand() when writing pluginrc
    
    instead of the previous ad-hoc hack.

 app/plug-in/plug-in-rc.c |   21 +--------------------
 1 files changed, 1 insertions(+), 20 deletions(-)
---
diff --git a/app/plug-in/plug-in-rc.c b/app/plug-in/plug-in-rc.c
index 80e77b1..38428f8 100644
--- a/app/plug-in/plug-in-rc.c
+++ b/app/plug-in/plug-in-rc.c
@@ -793,8 +793,6 @@ plug_in_rc_write (GSList  *plug_in_defs,
 {
   GimpConfigWriter *writer;
   GEnumClass       *enum_class;
-  const gchar      *plug_in_dir;
-  gint              plug_in_dir_length;
   GSList           *list;
 
   writer = gimp_config_writer_new_gfile (file,
@@ -809,9 +807,6 @@ plug_in_rc_write (GSList  *plug_in_defs,
 
   enum_class = g_type_class_ref (GIMP_TYPE_ICON_TYPE);
 
-  plug_in_dir        = gimp_plug_in_directory ();
-  plug_in_dir_length = strlen (plug_in_dir);
-
   gimp_config_writer_open (writer, "protocol-version");
   gimp_config_writer_printf (writer, "%d", GIMP_PROTOCOL_VERSION);
   gimp_config_writer_close (writer);
@@ -833,21 +828,7 @@ plug_in_rc_write (GSList  *plug_in_defs,
           gchar  *utf8;
 
           path = g_file_get_path (plug_in_def->file);
-
-          /* if possible, replace the beginning of path with a literal
-           * "${gimp_plug_in_dir}", to help things like app bundles
-           * which are mounted at random temo locations.
-           */
-          if (g_str_has_prefix (path, plug_in_dir))
-            {
-              gchar *tmp = g_strconcat ("${gimp_plug_in_dir}",
-                                        path + plug_in_dir_length,
-                                        NULL);
-              g_free (path);
-              path = tmp;
-            }
-
-          utf8 = g_filename_to_utf8 (path, -1, NULL, NULL, NULL);
+          utf8 = gimp_config_path_unexpand (path, TRUE, NULL);
           g_free (path);
 
           if (! utf8)


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