Commit 08cc3727 authored by Jehan's avatar Jehan

libgimpconfig: create parent directories for config file if necessary.

The directory should be already created by GIMP. But just in case it is
not there, for whatever reason, don't just fail. Try and create all
parent ada98782
......@@ -170,10 +170,25 @@ gimp_config_writer_new_gfile (GFile *file,
GimpConfigWriter *writer;
GOutputStream *output;
GFile *dir;
g_return_val_if_fail (G_IS_FILE (file), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
dir = g_file_get_parent (file);
if (dir && ! g_file_query_exists (dir, NULL))
if (! g_file_make_directory_with_parents (dir, NULL, error))
g_prefix_error (error,
_("Could not create directory '%s' for '%s': "),
gimp_file_get_utf8_name (dir),
gimp_file_get_utf8_name (file));
g_object_unref (dir);
if (error && *error)
return NULL;
if (atomic)
output = G_OUTPUT_STREAM (g_file_replace (file,
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