Hi Felipe,

Quoting Felipe Reyes <[EMAIL PROTECTED]>:

> hi to everyone.
> 
> I'm writing a little application to transform videos into a portable
> format (low quality and low size to let them fit into my palm and every
> portable device capable of play video), the application let you make
> batch transformations, so when the users select a video file or a
> directory i don't know how the difference, so I decided to assumme that
> the uri passed by the FileChooserDialog is a directory if that fails i
> catch the exception and try to open it again, but assuming that is a
> file, it works, but i dont like this solution, especially because the
> exception that Gnome.Vfs.Directory.GetEntries is
> 'Gnome.Vfs.VfsException' so its a very generic exception.
> 
> somebody know how can i fix this?, i am using mono/c#

You could simply use g_file_test () to check if the path refers to a directory.

Now, if you want to use the GnomeVFS facilities, you need to get the
GnomeVFSFileInfo for that URI, and then check the type field. Something like

GnomeVFSFileInfo *info;
info = gnome_vfs_file_info_new ();

result = gnome_vfs_get_file_info_uri (uri, info, 
                                      GNOME_VFS_FILE_INFO_DEFAULT |
                                      GNOME_VFS_FILE_INFO_FOLLOW_LINKS);

if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) {
  /* lala */
} else {
  /* lele */
}

gnome_vfs_file_info_unref (info);


Greetings,

Claudio

--
Claudio Saavedra <[EMAIL PROTECTED]>

-------------------------------------------------
Este correo fue enviado por http://alumnos.utalca.cl
_______________________________________________
gnome-love mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-love

Reply via email to