Getting webp file information
authorAlberto Ruiz <aruiz@gnome.org>
Mon, 4 Jul 2011 11:59:52 +0000 (12:59 +0100)
committerAlberto Ruiz <aruiz@gnome.org>
Mon, 4 Jul 2011 11:59:52 +0000 (12:59 +0100)
src/moonshot-webp-parser.vala

index b62b50e..497e77c 100644 (file)
@@ -10,6 +10,7 @@ namespace WebProvisioning
 
   public static int main (string[] args)
   {
+    int64 size;
     if (args.length < 2)
     {
       error ("Usage %s [-a] WEB_PROVISIONING_FILE", args[0]);
@@ -17,7 +18,19 @@ namespace WebProvisioning
     
     if (!FileUtils.test (args[1], FileTest.EXISTS | FileTest.IS_REGULAR))
     {
-      error ("Error: %s does not exist", args[1]);
+      error ("%s does not exist", args[1]);
+    }
+    
+    var file = File.new_for_path (args[1]);
+    
+    try
+    {
+      var info = file.query_info ("standard::size", FileQueryInfoFlags.NONE);
+      size = info.get_size();
+    }
+    catch (Error e)
+    {
+      error ("Could not retreive file size");
     }
     
     return 0;