[easytag/wip/help: 15/18] Add basic error reporting to mp4_header.cc



commit e776981890fd7313996bf752a376cf2187eb5805
Author: Santtu Lakkala <inz inz fi>
Date:   Fri Apr 11 12:01:16 2014 +0300

    Add basic error reporting to mp4_header.cc
    
    Add some error reporting enabled by updates in GIO wrapper to
    mp4_header.cc.

 src/mp4_header.cc |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/mp4_header.cc b/src/mp4_header.cc
index 533b1ac..ebb024c 100644
--- a/src/mp4_header.cc
+++ b/src/mp4_header.cc
@@ -38,6 +38,17 @@ gboolean Mp4_Header_Read_File_Info (gchar *filename, ET_File_Info *ETFileInfo)
 
     GFile *file = g_file_new_for_path (filename);
     GIO_InputStream stream (file);
+
+    if (!stream.isOpen ())
+    {
+        gchar *filename_utf8 = filename_to_display (filename);
+        const GError *error = stream.getError ();
+        Log_Print (LOG_ERROR, _("Error while opening file: '%s' (%s)."),
+                   filename_utf8, error->message);
+        g_free (filename_utf8);
+        return FALSE;
+    }
+
     TagLib::MP4::File mp4file (&stream);
 
     g_object_unref (file);


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