[PATCH 3/3] 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 file changed, 11 insertions(+)

diff --git a/src/mp4_header.cc b/src/mp4_header.cc
index 533b1ac..4cb9033 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);
-- 
1.8.3.2



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