1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Locating Standard Directories</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.0"><meta name="generator" content="GTK-Doc V1.1 (XML mode)"><style type="text/css">
2 .synopsis, .classsynopsis {
4 border: solid 1px #aaaaaa;
9 border: solid 1px #aaaaff;
18 border: solid 1px #ffaaaa;
25 .navigation a:visited {
31 </style><link rel="home" href="index.html" title="GnomeVFS - Filesystem Abstraction library"><link rel="up" href="gnome-vfs-directory-operations.html" title="Directory Handling"><link rel="previous" href="gnome-vfs-20-gnome-vfs-directory-list-ops.html" title="Listing Directory Contents"><link rel="next" href="gnome-vfs-file-operations.html" title="File Handling"></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="gnome-vfs-20-gnome-vfs-directory-list-ops.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="gnome-vfs-directory-operations.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">GnomeVFS - Filesystem Abstraction library</th><td><a accesskey="n" href="gnome-vfs-file-operations.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="gnome-vfs-20-gnome-vfs-directory-find-ops"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2><span class="refentrytitle">Locating Standard Directories</span></h2><p>Locating Standard Directories —
32 Utilities for locating standard directories such as the desktop and trash</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
36 enum <a href="gnome-vfs-20-gnome-vfs-directory-find-ops.html#GnomeVFSFindDirectoryKind">GnomeVFSFindDirectoryKind</a>;
37 <a href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult">GnomeVFSResult</a> <a href="gnome-vfs-20-gnome-vfs-directory-find-ops.html#gnome-vfs-find-directory">gnome_vfs_find_directory</a> (GnomeVFSURI *near_uri,
38 <a href="gnome-vfs-20-gnome-vfs-directory-find-ops.html#GnomeVFSFindDirectoryKind">GnomeVFSFindDirectoryKind</a> kind,
41 href="../glib/glib-Basic-Types.html#gboolean"
42 >gboolean</a> create_if_needed,
44 href="../glib/glib-Basic-Types.html#gboolean"
45 >gboolean</a> find_if_needed,
47 href="../glib/glib-Basic-Types.html#guint"
48 >guint</a> permissions);
49 </pre></div><div class="refsect1" lang="en"><h2>Description</h2><p>
51 </p></div><div class="refsect1" lang="en"><h2>Details</h2><div class="refsect2" lang="en"><h3><a name="GnomeVFSFindDirectoryKind"></a>enum GnomeVFSFindDirectoryKind</h3><a class="indexterm" name="id2891281"></a><pre class="programlisting">typedef enum {
52 GNOME_VFS_DIRECTORY_KIND_DESKTOP = 1000,
53 GNOME_VFS_DIRECTORY_KIND_TRASH = 1001
54 } GnomeVFSFindDirectoryKind;
57 </p></div><hr><div class="refsect2" lang="en"><h3><a name="gnome-vfs-find-directory"></a>gnome_vfs_find_directory ()</h3><a class="indexterm" name="id2891315"></a><pre class="programlisting"><a href="gnome-vfs-20-gnome-vfs-result.html#GnomeVFSResult">GnomeVFSResult</a> gnome_vfs_find_directory (GnomeVFSURI *near_uri,
58 <a href="gnome-vfs-20-gnome-vfs-directory-find-ops.html#GnomeVFSFindDirectoryKind">GnomeVFSFindDirectoryKind</a> kind,
61 href="../glib/glib-Basic-Types.html#gboolean"
62 >gboolean</a> create_if_needed,
64 href="../glib/glib-Basic-Types.html#gboolean"
65 >gboolean</a> find_if_needed,
67 href="../glib/glib-Basic-Types.html#guint"
68 >guint</a> permissions);</pre><p>
69 Used to return well known directories such as Trash, Desktop, etc. from different
72 There is quite a complicated logic behind finding/creating a Trash directory
73 and you need to be aware of some implications:
74 Finding the Trash the first time when using the file method may be pretty
75 expensive. A cache file is used to store the location of that Trash file
77 If <i class="parameter"><tt>ceate_if_needed</tt></i> is specified without <i class="parameter"><tt>find_if_needed</tt></i>, you may end up
78 creating a Trash file when there already is one. Your app should start out
79 by doing a gnome_vfs_find_directory with the <i class="parameter"><tt>find_if_needed</tt></i> to avoid this
80 and then use the <i class="parameter"><tt>create_if_needed</tt></i> flag to create Trash lazily when it is
81 needed for throwing away an item on a given disk.</p><p>
83 </p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>near_uri</tt></i> :</span></td><td> find a well known directory on the same volume as <i class="parameter"><tt>near_uri</tt></i>
84 </td></tr><tr><td><span class="term"><i class="parameter"><tt>kind</tt></i> :</span></td><td> kind of well known directory
85 </td></tr><tr><td><span class="term"><i class="parameter"><tt>result</tt></i> :</span></td><td> newly created URI of the directory we found
86 </td></tr><tr><td><span class="term"><i class="parameter"><tt>create_if_needed</tt></i> :</span></td><td> If directory we are looking for does not exist, try to create it
87 </td></tr><tr><td><span class="term"><i class="parameter"><tt>find_if_needed</tt></i> :</span></td><td> If we don't know where trash is yet, look for it.
88 </td></tr><tr><td><span class="term"><i class="parameter"><tt>permissions</tt></i> :</span></td><td> If creating, use these permissions
89 </td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> An integer representing the result of the operation
90 </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="gnome-vfs-20-gnome-vfs-directory-list-ops.html"><b><< Listing Directory Contents</b></a></td><td align="right"><a accesskey="n" href="gnome-vfs-file-operations.html"><b>File Handling >></b></a></td></tr></table></body></html>