Re: [Vala] [newbie] file_info.get_file_type



Thank you. That got me to the next problem, which is that if I invoke it ./walker ../, then the result of :
            string    d_name    =    file_info.get_name();
            File    f    =    File.new_for_path (d_name);
d_name is something like:
/home/charles/projects/Vala/Tutorials/tut2/tut2
or
/home/charles/projects/Vala/Tutorials/tut2/tut1
where:
/home/charles/projects/Vala/Tutorials/tut2/
is the directory that contains the application.

Apparently what's happening is the path returned is being built by prefixing the path to the directory that contains the application to the name of the file. I think I can get around this, sort of, by passing string for the path on each invocation, and building that string by appending the name of the current file, but that seems clunky, and it also seems like I must be doing something wrong when I ask for the file path.

OTOH, this works properly is I copy the application to the root that I wish to walk from, and either don't pass any parameters or just pass "./" (either with or without the quotes).

On 04/11/2011 11:09 PM, Jens Georg wrote:
On Mon, 2011-04-11 at 22:49 -0700, Charles Hixson wrote:
I   can't   figure   out   what   I'm   doing   wrong,   but
file_info.get_file_type   always   returns   a   value   of   0
(i.e.,   UNKNOWN):
That's correct, because…


// valac --pkg gio-2.0 walker.vala
// ./walker

void  walk (File directory)
{
     try
     {  var enumerator = directory.enumerate_children
(FILE_ATTRIBUTE_STANDARD_NAME, 0);
… you don't query for it. Change to FILE_ATTRIBUTE_STANDARD_NAME + "," +
FILE_ATTRIBUTE_STANDARD_TYPE to also get the type.

See http://developer.gnome.org/gio/stable/GFileInfo.html#GFileInfo for
all flags (just remove the G_ prefix) for the vala version.

_______________________________________________
vala-list mailing list
vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]