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):
// valac --pkg gio-2.0 walker.vala
// ./walker
void walk (File directory)
{
try
{ var enumerator = directory.enumerate_children
(FILE_ATTRIBUTE_STANDARD_NAME, 0);
FileInfo file_info;
while ((file_info = enumerator.next_file ()) != null)
{ var type = file_info.get_file_type();
string d_name = file_info.get_name();
File f = File.new_for_path (d_name);
stdout.printf ("file type = %d\n", type);
if (type == FileType.DIRECTORY)
{ walk (f); }
else
{ stdout.printf ("%s\n", f.get_path ()); }
}
}
catch (Error e)
{ stderr.printf ("Error: %s\n", e.message);
}
}
int main (string[] args)
{ File directory;
if (args.length > 1)
{ directory = File.new_for_commandline_arg (args[1]); }
else
{ directory = File.new_for_path ("."); }
walk (directory);
}
_______________________________________________
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list