1 /* test-mime.c - Test for the gnome_vfs_find_directory call
2 Virtual File System Library
4 Copyright (C) 2000 Eazel
6 The Gnome Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public License as
8 published by the Free Software Foundation; either version 2 of the
9 License, or (at your option) any later version.
11 The Gnome Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with the Gnome Library; see the file COPYING.LIB. If not,
18 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
21 Author: Pavel Cisler <pavel@eazel.com>
26 #include <glib/gmessages.h>
27 #include <libgnomevfs/gnome-vfs-find-directory.h>
28 #include <libgnomevfs/gnome-vfs-init.h>
29 #include <libgnomevfs/gnome-vfs-uri.h>
34 main (int argc, char **argv)
44 if (!gnome_vfs_init ()) {
45 fprintf (stderr, "Cannot initialize gnome-vfs.\n");
50 fprintf (stderr, "Usage: %s [-create] near_uri \n", *argv);
57 if (strcmp (*argv, "-create") == 0) {
62 uri = gnome_vfs_uri_new (*argv);
63 error = gnome_vfs_find_directory (uri, GNOME_VFS_DIRECTORY_KIND_TRASH, &result, create,
65 if (error == GNOME_VFS_OK) {
66 path = gnome_vfs_uri_to_string (result, GNOME_VFS_URI_HIDE_NONE);
67 g_print ("found trash at %s\n", path);
69 error = gnome_vfs_find_directory (uri, GNOME_VFS_DIRECTORY_KIND_TRASH,
70 &result, FALSE, FALSE, 0777);
71 if (error == GNOME_VFS_OK) {
72 path = gnome_vfs_uri_to_string (result, GNOME_VFS_URI_HIDE_NONE);
73 g_print ("found it again in a cached entry at %s\n", path);
76 g_print ("error %s finding cached trash entry near %s\n", gnome_vfs_result_to_string (error),
80 g_print ("error %s finding trash near %s\n", gnome_vfs_result_to_string (error),