?? glib-miscellaneous-utility-functions.html
字號:
} GUserDirectory;</pre><p>These are logical ids for special directories which are defineddepending on the platform used. You should use <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-get-user-special-dir"><code class="function">g_get_user_special_dir()</code></a>to retrieve the full path associated to the logical id.</p><p>The <a class="link" href="glib-Miscellaneous-Utility-Functions.html#GUserDirectory"><span class="type">GUserDirectory</span></a> enumeration can be extended at later date. Notevery platform has a directory for every logical id in thisenumeration.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><a name="G-USER-DIRECTORY-DESKTOP:CAPS"></a><code class="literal">G_USER_DIRECTORY_DESKTOP</code></span></p></td><td> the user's Desktop directory</td></tr><tr><td><p><span class="term"><a name="G-USER-DIRECTORY-DOCUMENTS:CAPS"></a><code class="literal">G_USER_DIRECTORY_DOCUMENTS</code></span></p></td><td> the user's Documents directory</td></tr><tr><td><p><span class="term"><a name="G-USER-DIRECTORY-DOWNLOAD:CAPS"></a><code class="literal">G_USER_DIRECTORY_DOWNLOAD</code></span></p></td><td> the user's Downloads directory</td></tr><tr><td><p><span class="term"><a name="G-USER-DIRECTORY-MUSIC:CAPS"></a><code class="literal">G_USER_DIRECTORY_MUSIC</code></span></p></td><td> the user's Music directory</td></tr><tr><td><p><span class="term"><a name="G-USER-DIRECTORY-PICTURES:CAPS"></a><code class="literal">G_USER_DIRECTORY_PICTURES</code></span></p></td><td> the user's Pictures directory</td></tr><tr><td><p><span class="term"><a name="G-USER-DIRECTORY-PUBLIC-SHARE:CAPS"></a><code class="literal">G_USER_DIRECTORY_PUBLIC_SHARE</code></span></p></td><td> the user's shared directory</td></tr><tr><td><p><span class="term"><a name="G-USER-DIRECTORY-TEMPLATES:CAPS"></a><code class="literal">G_USER_DIRECTORY_TEMPLATES</code></span></p></td><td> the user's Templates directory</td></tr><tr><td><p><span class="term"><a name="G-USER-DIRECTORY-VIDEOS:CAPS"></a><code class="literal">G_USER_DIRECTORY_VIDEOS</code></span></p></td><td> the user's Movies directory</td></tr><tr><td><p><span class="term"><a name="G-USER-N-DIRECTORIES:CAPS"></a><code class="literal">G_USER_N_DIRECTORIES</code></span></p></td><td> the number of enum values</td></tr></tbody></table></div><p class="since">Since 2.14</p></div><hr><div class="refsect2" lang="en"><a name="id3070916"></a><h3><a name="g-get-user-special-dir"></a>g_get_user_special_dir ()</h3><a class="indexterm" name="id3070931"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* g_get_user_special_dir (<a class="link" href="glib-Miscellaneous-Utility-Functions.html#GUserDirectory">GUserDirectory</a> directory);</pre><p>Returns the full path of a special directory using its logical id.</p><p>On Unix this is done using the XDG special user directories.</p><p>Depending on the platform, the user might be able to change the pathof the special directory without requiring the session to restart; GLibwill not reflect any change once the special directories are loaded.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>directory</code></em> :</span></p></td><td> the logical id of special directory</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the path to the specified special directory, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if the logical id was not found. The returned string is owned by GLib and should not be modified or freed.</td></tr></tbody></table></div><p class="since">Since 2.14</p></div><hr><div class="refsect2" lang="en"><a name="id3071026"></a><h3><a name="g-get-system-data-dirs"></a>g_get_system_data_dirs ()</h3><a class="indexterm" name="id3071042"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* const * g_get_system_data_dirs (void);</pre><p>Returns an ordered list of base directories in which to access system-wide application data.</p><p>On UNIX platforms this is determined using the mechanisms described inthe <a class="ulink" href="http://www.freedesktop.org/Standards/basedir-spec" target="_top">XDG Base Directory Specification</a></p><p>On Windows the first elements in the list are the Application Dataand Documents folders for All Users. (These can be determined onlyon Windows 2000 or later and are not present in the list on otherWindows versions.) See documentation for CSIDL_COMMON_APPDATA andCSIDL_COMMON_DOCUMENTS.</p><p>Then follows the "share" subfolder in the installation folder forthe package containing the DLL that calls this function, if it canbe determined.</p><p>Finally the list contains the "share" subfolder in the installationfolder for GLib, and in the installation folder for the package theapplication's .exe file belongs to.</p><p>The installation folders above are determined by looking up thefolder where the module (DLL or EXE) in question is located. If thefolder's name is "bin", its parent is used, otherwise the folderitself.</p><p>Note that on Windows the returned list can vary depending on wherethis function is called.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings owned by GLib that must not be modified or freed.</td></tr></tbody></table></div><p class="since">Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3071146"></a><h3><a name="g-get-system-config-dirs"></a>g_get_system_config_dirs ()</h3><a class="indexterm" name="id3071161"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* const * g_get_system_config_dirs (void);</pre><p>Returns an ordered list of base directories in which to access system-wide configuration information.</p><p>On UNIX platforms this is determined using the mechanisms described inthe <a class="ulink" href="http://www.freedesktop.org/Standards/basedir-spec" target="_top">XDG Base Directory Specification</a></p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings owned by GLib that must not be modified or freed.</td></tr></tbody></table></div><p class="since">Since 2.6</p></div><hr><div class="refsect2" lang="en"><a name="id3071232"></a><h3><a name="g-get-host-name"></a>g_get_host_name ()</h3><a class="indexterm" name="id3071248"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* g_get_host_name (void);</pre><p>Return a name for the machine. </p><p>The returned name is not necessarily a fully-qualified domain name,or even present in DNS or some other name service at all. It neednot even be unique on your local network or site, but usually itis. Callers should not rely on the return value having any specificproperties like uniqueness for security purposes. Even if the nameof the machine is changed while an application is running, thereturn value from this function does not change. The returnedstring is owned by GLib and should not be modified or freed. If noname can be determined, a default fixed string "localhost" isreturned.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the host name of the machine.</td></tr></tbody></table></div><p class="since">Since 2.8</p></div><hr><div class="refsect2" lang="en"><a name="id3068246"></a><h3><a name="g-get-home-dir"></a>g_get_home_dir ()</h3><a class="indexterm" name="id3068258"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* g_get_home_dir (void);</pre><p>Gets the current user's home directory as defined in the password database.</p><p>Note that in contrast to traditional UNIX tools, this function prefers <code class="filename">passwd</code> entries over the <code class="envar">HOME</code> environment variable. </p><p>One of the reasons for this decision is that applications in many cases need special handling to deal with the case where <code class="envar">HOME</code> is</p><table class="simplelist" border="0" summary="Simple list"><tr><td>Not owned by the user</td></tr><tr><td>Not writeable</td></tr><tr><td>Not even readable</td></tr></table><p>Since applications are in general <span class="emphasis"><em>not</em></span> written to deal with these situations it was considered better to make <code class="function">g_get_homedir()</code> not pay attention to <code class="envar">HOME</code> and to return the real home directory for the user. If applicationswant to pay attention to <code class="envar">HOME</code>, they can do:</p><div class="informalexample"><pre class="programlisting"> const char *homedir = g_getenv ("HOME"); if (!homedir) homedir = g_get_homedir ();</pre></div><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -