GnomeVFSFileType vs. mime types
- From: Darin Fisher <darin meer net>
- To: gnome-vfs-list gnome org
- Subject: GnomeVFSFileType vs. mime types
- Date: Tue, 10 Aug 2004 12:58:39 -0500
I developed an extension for Mozilla that uses GnomeVFS to access
protocols such as smb: and sftp:. To support directory listings as well
as file retrieval, I had to add code to determine whether to call
gnome_vfs_directory_open or simply gnome_vfs_open. The code I used
checks the mime type of the URL by callling gnome_vfs_get_file_info.
I noticed that this function seems to return a mime type of
"x-directory/normal" when the URL corresponds to a directory. So, the
code in Mozilla currently tests for this mime type, and calls
gnome_vfs_directory_open if it detects this mime type.
Now, when I upgraded my system to Gnome 2.6, I noticed that the smb:
protocol handler sometimes returns a mime type of "x-directory/smbshare"
and in some cases it even returns an empty string for the mime type. I
think the empty string case is probably a bug in the smb: protocol
handler code, but I haven't verified that.
At this point, I feel that checking the mime type is probably not the
best solution. I could check for "x-directory/" prefixes, but I haven't
found any documentation to confirm that that is the right thing to do.
And, besides... what do I do in the case where that mime type is
sometimes empty?
So, I modified the code to use the GnomeVFSFileInfo::type instead of
mime_type. I just test for the value of GNOME_VFS_FILE_TYPE_DIRECTORY,
and everything appears to be happy.
However, there is this comment in gnome-vfs-file-info.h:
/**
* GnomeVFSFileType:
...
* Identifies the kind of file represented by a #GnomeVFSFileInfo
struct. (note,
* use of MIME types is preferred as this field may eventually disappear)
**/
So, if use of mime types is preferred, what should I do?
Thanks in advance for any advice,
Darin
p.s., this is in regard to
http://bugzilla.mozilla.org/show_bug.cgi?id=255032
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]