libgimpbase: add gimp_installation_directory()
which returns the toplevel directory of the running GIMP installation.
This commit is contained in:
@ -41,6 +41,7 @@ EXPORTS
|
|||||||
gimp_icon_type_get_type
|
gimp_icon_type_get_type
|
||||||
gimp_image_base_type_get_type
|
gimp_image_base_type_get_type
|
||||||
gimp_image_type_get_type
|
gimp_image_type_get_type
|
||||||
|
gimp_installation_directory
|
||||||
gimp_interpolation_type_get_type
|
gimp_interpolation_type_get_type
|
||||||
gimp_locale_directory
|
gimp_locale_directory
|
||||||
gimp_major_version
|
gimp_major_version
|
||||||
|
@ -321,8 +321,26 @@ DllMain (HINSTANCE hinstDLL,
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const gchar *
|
/**
|
||||||
gimp_toplevel_directory (void)
|
* gimp_installation_directory:
|
||||||
|
*
|
||||||
|
* Returns the top installation directory of GIMP. On Unix the
|
||||||
|
* compile-time defined installation prefix is used. On Windows, the
|
||||||
|
* installation directory as deduced from the executable's full
|
||||||
|
* filename is used. On OSX we ask [NSBundle mainBundle] for the
|
||||||
|
* resource path to check if GIMP is part of a relocatable bundle.
|
||||||
|
*
|
||||||
|
* The returned string is owned by GIMP and must not be modified or
|
||||||
|
* freed. The returned string is in the encoding used for filenames by
|
||||||
|
* GLib, which isn't necessarily UTF-8. (On Windows it always is
|
||||||
|
* UTF-8.)
|
||||||
|
*
|
||||||
|
* Since: GIMP 2.8
|
||||||
|
*
|
||||||
|
* Returns: The toplevel installation directory of GIMP.
|
||||||
|
**/
|
||||||
|
const gchar *
|
||||||
|
gimp_installation_directory (void)
|
||||||
{
|
{
|
||||||
static gchar *toplevel = NULL;
|
static gchar *toplevel = NULL;
|
||||||
|
|
||||||
@ -655,7 +673,7 @@ gimp_path_runtime_fix (gchar **path)
|
|||||||
* real one on this machine.
|
* real one on this machine.
|
||||||
*/
|
*/
|
||||||
p = *path;
|
p = *path;
|
||||||
*path = g_strconcat (gimp_toplevel_directory (),
|
*path = g_strconcat (gimp_installation_directory (),
|
||||||
"\\",
|
"\\",
|
||||||
*path + strlen (PREFIX "/"),
|
*path + strlen (PREFIX "/"),
|
||||||
NULL);
|
NULL);
|
||||||
@ -674,7 +692,7 @@ gimp_path_runtime_fix (gchar **path)
|
|||||||
gchar *p = *path;
|
gchar *p = *path;
|
||||||
if (!g_path_is_absolute (p))
|
if (!g_path_is_absolute (p))
|
||||||
{
|
{
|
||||||
*path = g_build_filename (gimp_toplevel_directory (), *path, NULL);
|
*path = g_build_filename (gimp_installation_directory (), *path, NULL);
|
||||||
g_free (p);
|
g_free (p);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -687,7 +705,7 @@ gimp_path_runtime_fix (gchar **path)
|
|||||||
* real one on this machine.
|
* real one on this machine.
|
||||||
*/
|
*/
|
||||||
p = *path;
|
p = *path;
|
||||||
*path = g_build_filename (gimp_toplevel_directory (),
|
*path = g_build_filename (gimp_installation_directory (),
|
||||||
*path + strlen (PREFIX G_DIR_SEPARATOR_S),
|
*path + strlen (PREFIX G_DIR_SEPARATOR_S),
|
||||||
NULL);
|
NULL);
|
||||||
g_free (p);
|
g_free (p);
|
||||||
|
@ -48,6 +48,7 @@ GIMPVAR const guint gimp_micro_version;
|
|||||||
|
|
||||||
|
|
||||||
const gchar * gimp_directory (void) G_GNUC_CONST;
|
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_data_directory (void) G_GNUC_CONST;
|
||||||
const gchar * gimp_locale_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_sysconf_directory (void) G_GNUC_CONST;
|
||||||
|
Reference in New Issue
Block a user