[GNOME VFS] [PATCH] gnome_vfs_uri_extract_dirname misses some cases.
David Emory Watson <[email protected]>
| Newsgroups | gmane.comp.gnome.vfs |
|---|---|
| Message-ID | <1020475408.18458.144.camel@galois> |
According to the comment above gnome_vfs_uri_extract_dirname (),
"Extract the name of the directory in which the file pointed to by @uri
is stored as a newly allocated string. The string will end with a
GNOME_VFS_URI_PATH_CHR."
Thus the following code would be expected to print "/":
GnomeVFSURI uri;
uri->text = "/foo";
printf ("%s", gnome_vfs_uri_extract_dirname (&uri));
Unfortunately nothing is printed (i.e. the string ="\0"). Please let me
know if I can commit this patch since I have nautilus location bar
changes that I would like to commit once this is done.
dirname-patch
(text/x-patch, 1.2 KB)
Index: ChangeLog =================================================================== RCS file: /cvs/gnome/gnome-vfs/ChangeLog,v retrieving revision 1.1282 diff -p -u -r1.1282 ChangeLog --- ChangeLog 2 May 2002 21:07:27 -0000 1.1282 +++ ChangeLog 4 May 2002 01:02:11 -0000 @@ -1,3 +1,10 @@ +2002-05-03 David Emory Watson <[email protected]> + + * libgnomevfs/gnome-vfs-uri.c: + (gnome_vfs_uri_extract_dirname): Should return URI_PATH_STR whenever + there is only one URI_PATH_CHR in the uri, not just when the string + equals URI_PATH_CHR. + 2002-05-02 Bastien Nocera <[email protected]> * test/test-directory.c: (show_result): Index: libgnomevfs/gnome-vfs-uri.c =================================================================== RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-uri.c,v retrieving revision 1.102 diff -p -u -r1.102 gnome-vfs-uri.c --- libgnomevfs/gnome-vfs-uri.c 5 Nov 2001 08:06:59 -0000 1.102 +++ libgnomevfs/gnome-vfs-uri.c 4 May 2002 01:02:11 -0000 @@ -1644,7 +1644,7 @@ gnome_vfs_uri_extract_dirname (const Gno base = strrchr (uri->text, GNOME_VFS_URI_PATH_CHR); - if (base == NULL || base[1] == '\0') { + if (base == NULL || base == uri->text) { return g_strdup (GNOME_VFS_URI_PATH_STR); }