Re: [Vala] Listing directory content with GIO
- From: Frederik <scumm_fredo gmx net>
- To: vala-list <vala-list gnome org>
- Subject: Re: [Vala] Listing directory content with GIO
- Date: Wed, 06 May 2009 16:53:29 +0200
Jan Niklas Hasse wrote:
I've tried to list the files in a directory (not using async
functions). This is what I've got:
var libPath = File.new_for_path("/lib/");
var enumerator =
libPath.enumerate_children(FILE_ATTRIBUTE_STANDARD_NAME, 0, null);
var fileinfo = enumerator.next_file(null);
while(fileinfo != null)
{
stdout.printf("%s\n", fileinfo.get_name());
fileinfo = enumerator.next_file(null);
}
Is there an easier way of doing it? I don't like that I have "fileinfo
= enumerator.next_file(null);" two times in my code.
FileInfo fileinfo;
while ((fileinfo = enumerator.next_file(null)) != null)
{
stdout.printf("%s\n", fileinfo.get_name());
}
Regards,
Frederik
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]