Files
gimp/devel-docs/libgimpbase/html/libgimpbase-gimpenv.html
2010-08-11 01:14:17 -04:00

142 lines
15 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gimpenv</title><meta name="generator" content="DocBook XSL Stylesheets V1.66.1"><link rel="start" href="index.html" title="GIMP Base Library Reference Manual"><link rel="up" href="libgimpbase.html" title="Part I. GIMP Base Library"><link rel="prev" href="libgimpbase-gimpdatafiles.html" title="gimpdatafiles"><link rel="next" href="libgimpbase-gimpmemsize.html" title="gimpmemsize"><meta name="generator" content="GTK-Doc V1.3 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="libgimpbase.html" title="Part I. GIMP Base Library"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libgimpbase-gimpdatafiles.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="libgimpbase.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GIMP Base Library Reference Manual</th><td><a accesskey="n" href="libgimpbase-gimpmemsize.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="libgimpbase-gimpenv"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><span class="refentrytitle">gimpenv</span></h2><p>gimpenv &#8212; Functions to access the GIMP environment.</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
const gchar* <a href="libgimpbase-gimpenv.html#gimp-directory">gimp_directory</a> (void);
gchar* <a href="libgimpbase-gimpenv.html#gimp-personal-rc-file">gimp_personal_rc_file</a> (const gchar *basename);
const gchar* <a href="libgimpbase-gimpenv.html#gimp-data-directory">gimp_data_directory</a> (void);
const gchar* <a href="libgimpbase-gimpenv.html#gimp-locale-directory">gimp_locale_directory</a> (void);
const gchar* <a href="libgimpbase-gimpenv.html#gimp-plug-in-directory">gimp_plug_in_directory</a> (void);
const gchar* <a href="libgimpbase-gimpenv.html#gimp-sysconf-directory">gimp_sysconf_directory</a> (void);
const gchar* <a href="libgimpbase-gimpenv.html#gimp-gtkrc">gimp_gtkrc</a> (void);
GList* <a href="libgimpbase-gimpenv.html#gimp-path-parse">gimp_path_parse</a> (const gchar *path,
gint max_paths,
gboolean check,
GList **check_failed);
gchar* <a href="libgimpbase-gimpenv.html#gimp-path-to-str">gimp_path_to_str</a> (GList *path);
void <a href="libgimpbase-gimpenv.html#gimp-path-free">gimp_path_free</a> (GList *path);
gchar* <a href="libgimpbase-gimpenv.html#gimp-path-get-user-writable-dir">gimp_path_get_user_writable_dir</a> (GList *path);
</pre></div><div class="refsect1" lang="en"><a name="id2581158"></a><h2>Description</h2><p>
A set of functions to find the locations of GIMP's data directories and
configuration files.
</p></div><div class="refsect1" lang="en"><a name="id2581169"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id2581174"></a><h3><a name="gimp-directory"></a>gimp_directory ()</h3><a class="indexterm" name="id2581183"></a><pre class="programlisting">const gchar* gimp_directory (void);</pre><p>
Returns the user-specific GIMP settings directory. If the
environment variable GIMP2_DIRECTORY exists, it is used. If it is
an absolute path, it is used as is. If it is a relative path, it
is taken to be a subdirectory of the home directory. If it is a
relative path, and no home directory can be determined, it is taken
to be a subdirectory of <a href="libgimpbase-gimpenv.html#gimp-data-directory"><tt class="function">gimp_data_directory()</tt></a>.
</p><p>
The usual case is that no GIMP2_DIRECTORY environment variable
exists, and then we use the GIMPDIR subdirectory of the home
directory. If no home directory exists, we use a per-user
subdirectory of <a href="libgimpbase-gimpenv.html#gimp-data-directory"><tt class="function">gimp_data_directory()</tt></a>. In any case, we always
return some non-empty string, whether it corresponds to an existing
directory or not.
</p><p>
The returned string is allocated just once, and should *NOT* be
freed with <tt class="function">g_free()</tt>. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The user-specific GIMP settings directory.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2581256"></a><h3><a name="gimp-personal-rc-file"></a>gimp_personal_rc_file ()</h3><a class="indexterm" name="id2581264"></a><pre class="programlisting">gchar* gimp_personal_rc_file (const gchar *basename);</pre><p>
Returns the name of a file in the user-specific GIMP settings directory.
</p><p>
The returned string is allocated dynamically and *SHOULD* be freed
with <tt class="function">g_free()</tt> after use. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>basename</tt></i> :</span></td><td> The basename of a rc_file.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The name of a file in the user-specific GIMP settings directory.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2534792"></a><h3><a name="gimp-data-directory"></a>gimp_data_directory ()</h3><a class="indexterm" name="id2534801"></a><pre class="programlisting">const gchar* gimp_data_directory (void);</pre><p>
Returns the top directory for GIMP data. If the environment
variable GIMP2_DATADIR exists, that is used. It should be an
absolute pathname. Otherwise, on Unix the compile-time defined
directory is used. On Win32, the installation directory as deduced
from the executable's name is used.
</p><p>
The returned string is allocated just once, and should *NOT* be
freed with <tt class="function">g_free()</tt>. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The top directory for GIMP data.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2534851"></a><h3><a name="gimp-locale-directory"></a>gimp_locale_directory ()</h3><a class="indexterm" name="id2534859"></a><pre class="programlisting">const gchar* gimp_locale_directory (void);</pre><p>
Returns the top directory for GIMP locale files. If the environment
variable GIMP2_LOCALEDIR exists, that is used. It should be an
absolute pathname. Otherwise, on Unix the compile-time defined
directory is used. On Win32, the installation directory as deduced
from the executable's name is used.
</p><p>
The returned string is allocated just once, and should *NOT* be
freed with <tt class="function">g_free()</tt>. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The top directory for GIMP locale files.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2534909"></a><h3><a name="gimp-plug-in-directory"></a>gimp_plug_in_directory ()</h3><a class="indexterm" name="id2534918"></a><pre class="programlisting">const gchar* gimp_plug_in_directory (void);</pre><p>
Returns the top directory for GIMP plug_ins and modules. If the
environment variable GIMP2_PLUGINDIR exists, that is used. It
should be an absolute pathname. Otherwise, on Unix the compile-time
defined directory is used. On Win32, the installation directory as
deduced from the executable's name is used.
</p><p>
The returned string is allocated just once, and should *NOT* be
freed with <tt class="function">g_free()</tt>. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The top directory for GIMP plug_ins and modules.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2534969"></a><h3><a name="gimp-sysconf-directory"></a>gimp_sysconf_directory ()</h3><a class="indexterm" name="id2534977"></a><pre class="programlisting">const gchar* gimp_sysconf_directory (void);</pre><p>
Returns the top directory for GIMP config files. If the environment
variable GIMP2_SYSCONFDIR exists, that is used. It should be an
absolute pathname. Otherwise, on Unix the compile-time defined
directory is used. On Win32, the installation directory as deduced
from the executable's name is used.
</p><p>
The returned string is allocated just once, and should *NOT* be
freed with <tt class="function">g_free()</tt>. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The top directory for GIMP config files.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2562493"></a><h3><a name="gimp-gtkrc"></a>gimp_gtkrc ()</h3><a class="indexterm" name="id2562500"></a><pre class="programlisting">const gchar* gimp_gtkrc (void);</pre><p>
Returns the name of the GIMP's application-specific gtkrc file.
</p><p>
The returned string is allocated just once, and should *NOT* be
freed with <tt class="function">g_free()</tt>. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The name of the GIMP's application-specific gtkrc file.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2562547"></a><h3><a name="gimp-path-parse"></a>gimp_path_parse ()</h3><a class="indexterm" name="id2562555"></a><pre class="programlisting">GList* gimp_path_parse (const gchar *path,
gint max_paths,
gboolean check,
GList **check_failed);</pre><p>
</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>path</tt></i> :</span></td><td> A list of directories separated by <span class="type">G_SEARCHPATH_SEPARATOR</span>.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>max_paths</tt></i> :</span></td><td> The maximum number of directories to return.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>check</tt></i> :</span></td><td> <tt class="literal">TRUE</tt> if you want the directories to be checked.
</td></tr><tr><td><span class="term"><i class="parameter"><tt>check_failed</tt></i> :</span></td><td> Returns a <span class="type">GList</span> of path elements for which the
check failed.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> A <span class="type">GList</span> of all directories in <i class="parameter"><tt>path</tt></i>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2562683"></a><h3><a name="gimp-path-to-str"></a>gimp_path_to_str ()</h3><a class="indexterm" name="id2562691"></a><pre class="programlisting">gchar* gimp_path_to_str (GList *path);</pre><p>
</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>path</tt></i> :</span></td><td> A list of directories as returned by <a href="libgimpbase-gimpenv.html#gimp-path-parse"><tt class="function">gimp_path_parse()</tt></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> A searchpath string separated by <span class="type">G_SEARCHPATH_SEPARATOR</span>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2562752"></a><h3><a name="gimp-path-free"></a>gimp_path_free ()</h3><a class="indexterm" name="id2582832"></a><pre class="programlisting">void gimp_path_free (GList *path);</pre><p>
This function frees the memory allocated for the list and the strings
it contains.</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>path</tt></i> :</span></td><td> A list of directories as returned by <a href="libgimpbase-gimpenv.html#gimp-path-parse"><tt class="function">gimp_path_parse()</tt></a>.
</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2582878"></a><h3><a name="gimp-path-get-user-writable-dir"></a>gimp_path_get_user_writable_dir ()</h3><a class="indexterm" name="id2582886"></a><pre class="programlisting">gchar* gimp_path_get_user_writable_dir (GList *path);</pre><p>
Note that you have to <tt class="function">g_free()</tt> the returned string.</p><p>
</p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>path</tt></i> :</span></td><td> A list of directories as returned by <a href="libgimpbase-gimpenv.html#gimp-path-parse"><tt class="function">gimp_path_parse()</tt></a>.
</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The first directory in <i class="parameter"><tt>path</tt></i> where the user has write permission.
</td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="libgimpbase-gimpdatafiles.html"><b>&lt;&lt; gimpdatafiles</b></a></td><td align="right"><a accesskey="n" href="libgimpbase-gimpmemsize.html"><b>gimpmemsize &gt;&gt;</b></a></td></tr></table></body></html>