Re: [Vala] How to get date/time infos from a file ?



On Mi, 2013-08-21 at 15:39 +0200, raum no-log org wrote:
Well, Im' trying something like :
      var file = File.new_for_path ("some_file.txt");
      var file_info = file.query_info ("*::*", 0);

Should be file.query_info ("*", 0) for everything

    int64 file_stamp =
 file_info.get_attribute_int64(FileAttribute.TIME_ACCESS);

    stdout.printf ("%" + int64.FORMAT + "\n", file_stamp);

But result is "0".... :-?

where am I wrong ?


On Mi, 2013-08-21 at 14:41 +0200, raum no-log org wrote:
Hello,

I'm trying to get informations like TIME_ACCESS, TIME_CREATED, ... from
a
file but I don't know how.

For example :
   var file = File.new_for_path ("some_file.txt");

You have to add things you want to extract from the FileInfo on the line
below also in the line here (or use "*" to get everything).

   var file_info = file.query_info (FILE_ATTRIBUTE_STANDARD_NAME + "," +
FILE_ATTRIBUTE_STANDARD_TYPE, 0);
   int64 file_stamp =
file_info.get_attribute_int64(FileAttribute.TIME_ACCESS);

   stdout.printf ("%" + int64.FORMAT + "\n", file_stamp);


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






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