Commit bafe4419 authored by Michael Natterer's avatar Michael Natterer 😴

libgimpconfig: (de)serialize GFile properties as config paths

so they are found in relocated prefixes / user configs.
parent b8bb52b7
......@@ -872,9 +872,20 @@ gimp_config_deserialize_file_value (GValue *value,
}
else
{
GFile *file = g_file_parse_name (scanner->value.v_string);
gchar *path = gimp_config_path_expand (scanner->value.v_string, TRUE,
NULL);
g_value_take_object (value, file);
if (path)
{
GFile *file = g_file_new_for_path (path);
g_value_take_object (value, file);
g_free (path);
}
else
{
g_value_set_object (value, NULL);
}
}
return G_TOKEN_RIGHT_PAREN;
......
......@@ -34,6 +34,7 @@
#include "gimpconfigwriter.h"
#include "gimpconfig-iface.h"
#include "gimpconfig-params.h"
#include "gimpconfig-path.h"
#include "gimpconfig-serialize.h"
#include "gimpconfig-utils.h"
......@@ -491,14 +492,28 @@ gimp_config_serialize_value (const GValue *value,
if (file)
{
gchar *parse_name = g_file_get_parse_name (file);
gchar *path = g_file_get_path (file);
gchar *unexpand = NULL;
if (escaped)
gimp_config_string_append_escaped (str, parse_name);
else
g_string_append (str, parse_name);
if (path)
{
unexpand = gimp_config_path_unexpand (path, TRUE, NULL);
g_free (path);
}
if (unexpand)
{
if (escaped)
gimp_config_string_append_escaped (str, unexpand);
else
g_string_append (str, unexpand);
g_free (parse_name);
g_free (unexpand);
}
else
{
g_string_append (str, "NULL");
}
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment