[gimp] app: gimp_get_temp_file() / gimp_temp_name() should create tmp/ if...



commit 33d933608384a447171d3c85263bc0f09e7b9944
Author: Jehan <jehan girinstud io>
Date:   Mon Apr 23 00:35:01 2018 +0200

    app: gimp_get_temp_file() / gimp_temp_name() should create tmp/ if...
    
    ... it doesn't exist.
    The tmp/ dir in the config folder should already be created by GIMP, but
    just in case it is not there, try and create it, since all code calling
    these assumes that it exists.

 app/core/gimp.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimp.c b/app/core/gimp.c
index 8acf88a..85896bb 100644
--- a/app/core/gimp.c
+++ b/app/core/gimp.c
@@ -1183,6 +1183,13 @@ gimp_get_temp_file (Gimp        *gimp,
 
   dir = gimp_file_new_for_config_path (GIMP_GEGL_CONFIG (gimp->config)->temp_path,
                                        NULL);
+  if (! g_file_query_exists (dir, NULL))
+    {
+      /* Try to make the temp directory if it doesn't exist.
+       * Ignore any error.
+       */
+      g_file_make_directory_with_parents (dir, NULL, NULL);
+    }
   file = g_file_get_child (dir, basename);
   g_free (basename);
   g_object_unref (dir);


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