[gimp] libgimpbase: add gimp_installation_directory_file().



commit db00616888856dce1558fa5f68c77807cf27b3b9
Author: Jehan <jehan girinstud io>
Date:   Sat Feb 2 18:47:58 2019 +0100

    libgimpbase: add gimp_installation_directory_file().
    
    Fix previous commit.
    Ahahah! Mitch, you didn't test your code before pushing! Bad boy! :P

 libgimpbase/gimpenv.c | 30 +++++++++++++++++++++++
 libgimpbase/gimpenv.h | 66 ++++++++++++++++++++++++++-------------------------
 2 files changed, 64 insertions(+), 32 deletions(-)
---
diff --git a/libgimpbase/gimpenv.c b/libgimpbase/gimpenv.c
index 639aa8ca80..d055d486f6 100644
--- a/libgimpbase/gimpenv.c
+++ b/libgimpbase/gimpenv.c
@@ -760,6 +760,36 @@ gimp_directory_file (const gchar *first_element,
   return file;
 }
 
+/**
+ * gimp_installation_directory_file:
+ * @first_element: the first element of a path to a file in the
+ *                 top installation directory, or %NULL.
+ * @...: a %NULL terminated list of the remaining elements of the path
+ *       to the file.
+ *
+ * Returns a #GFile in the installation directory, or the installation
+ * directory itself if @first_element is %NULL.
+ *
+ * See also: gimp_installation_directory().
+ *
+ * Since: 2.10.10
+ *
+ * Returns: a new @GFile for the path, Free with g_object_unref().
+ **/
+GFile *
+gimp_installation_directory_file (const gchar *first_element,
+                                  ...)
+{
+  GFile   *file;
+  va_list  args;
+
+  va_start (args, first_element);
+  file = gimp_child_file (gimp_installation_directory (), first_element, args);
+  va_end (args);
+
+  return file;
+}
+
 /**
  * gimp_data_directory_file:
  * @first_element: the first element of a path to a file in the
diff --git a/libgimpbase/gimpenv.h b/libgimpbase/gimpenv.h
index a5a1094153..502142abbe 100644
--- a/libgimpbase/gimpenv.h
+++ b/libgimpbase/gimpenv.h
@@ -47,41 +47,43 @@ GIMPVAR const guint gimp_minor_version;
 GIMPVAR const guint gimp_micro_version;
 
 
-const gchar * gimp_directory                  (void) G_GNUC_CONST;
-const gchar * gimp_installation_directory     (void) G_GNUC_CONST;
-const gchar * gimp_data_directory             (void) G_GNUC_CONST;
-const gchar * gimp_locale_directory           (void) G_GNUC_CONST;
-const gchar * gimp_sysconf_directory          (void) G_GNUC_CONST;
-const gchar * gimp_plug_in_directory          (void) G_GNUC_CONST;
-const gchar * gimp_cache_directory            (void) G_GNUC_CONST;
-const gchar * gimp_temp_directory             (void) G_GNUC_CONST;
-
-GFile       * gimp_directory_file             (const gchar *first_element,
-                                               ...) G_GNUC_MALLOC;
-GFile       * gimp_data_directory_file        (const gchar *first_element,
-                                               ...) G_GNUC_MALLOC;
-GFile       * gimp_locale_directory_file      (const gchar *first_element,
-                                               ...) G_GNUC_MALLOC;
-GFile       * gimp_sysconf_directory_file     (const gchar *first_element,
-                                               ...) G_GNUC_MALLOC;
-GFile       * gimp_plug_in_directory_file     (const gchar *first_element,
-                                               ...) G_GNUC_MALLOC;
-
-const gchar * gimp_gtkrc                      (void) G_GNUC_CONST;
-gchar       * gimp_personal_rc_file           (const gchar        *basename) G_GNUC_MALLOC;
-
-GList       * gimp_path_parse                 (const gchar        *path,
-                                               gint                max_paths,
-                                               gboolean            check,
-                                               GList             **check_failed);
-gchar       * gimp_path_to_str                (GList              *path) G_GNUC_MALLOC;
-void          gimp_path_free                  (GList              *path);
-
-gchar       * gimp_path_get_user_writable_dir (GList              *path) G_GNUC_MALLOC;
+const gchar * gimp_directory                   (void) G_GNUC_CONST;
+const gchar * gimp_installation_directory      (void) G_GNUC_CONST;
+const gchar * gimp_data_directory              (void) G_GNUC_CONST;
+const gchar * gimp_locale_directory            (void) G_GNUC_CONST;
+const gchar * gimp_sysconf_directory           (void) G_GNUC_CONST;
+const gchar * gimp_plug_in_directory           (void) G_GNUC_CONST;
+const gchar * gimp_cache_directory             (void) G_GNUC_CONST;
+const gchar * gimp_temp_directory              (void) G_GNUC_CONST;
+
+GFile       * gimp_directory_file              (const gchar *first_element,
+                                                ...) G_GNUC_MALLOC;
+GFile       * gimp_installation_directory_file (const gchar *first_element,
+                                                ...) G_GNUC_MALLOC;
+GFile       * gimp_data_directory_file         (const gchar *first_element,
+                                                ...) G_GNUC_MALLOC;
+GFile       * gimp_locale_directory_file       (const gchar *first_element,
+                                                ...) G_GNUC_MALLOC;
+GFile       * gimp_sysconf_directory_file      (const gchar *first_element,
+                                                ...) G_GNUC_MALLOC;
+GFile       * gimp_plug_in_directory_file      (const gchar *first_element,
+                                                ...) G_GNUC_MALLOC;
+
+const gchar * gimp_gtkrc                       (void) G_GNUC_CONST;
+gchar       * gimp_personal_rc_file            (const gchar        *basename) G_GNUC_MALLOC;
+
+GList       * gimp_path_parse                  (const gchar        *path,
+                                                gint                max_paths,
+                                                gboolean            check,
+                                                GList             **check_failed);
+gchar       * gimp_path_to_str                 (GList              *path) G_GNUC_MALLOC;
+void          gimp_path_free                   (GList              *path);
+
+gchar       * gimp_path_get_user_writable_dir  (GList              *path) G_GNUC_MALLOC;
 
 
 /*  should be considered private, don't use!  */
-void          gimp_env_init                   (gboolean            plug_in);
+void          gimp_env_init                    (gboolean            plug_in);
 
 
 G_END_DECLS


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