[Vala] [vala][newbie] file_info.get_file_type
- From: Charles Hixson <charleshixsn earthlink net>
- To: vala-list gnome org
- Subject: [Vala] [vala][newbie] file_info.get_file_type
- Date: Sat, 07 May 2011 20:28:25 -0000
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]