[glib] gio: Include filename in error message
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gio: Include filename in error message
- Date: Thu, 28 Jan 2016 02:06:44 +0000 (UTC)
commit 42699e37bea10fc51dd1a79888dfd8edae84c70a
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jan 27 21:05:31 2016 -0500
gio: Include filename in error message
I'm tired of seeing 'No such file or directory' in the logs without
a hint as to what is actually wrong. Including the filename here
may help me tracking down a bug in the continuous infrastructure.
gio/glocalfileenumerator.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gio/glocalfileenumerator.c b/gio/glocalfileenumerator.c
index 60c9b9a..8f0d091 100644
--- a/gio/glocalfileenumerator.c
+++ b/gio/glocalfileenumerator.c
@@ -232,11 +232,15 @@ _g_local_file_enumerator_new (GLocalFile *file,
dir = opendir (filename);
if (dir == NULL)
{
+ gchar *utf8_filename;
errsv = errno;
- g_set_error_literal (error, G_IO_ERROR,
- g_io_error_from_errno (errsv),
- g_strerror (errsv));
+ utf8_filename = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+ g_set_error (error, G_IO_ERROR,
+ g_io_error_from_errno (errsv),
+ "Error opening directory '%s': %s",
+ utf8_filename, g_strerror (errsv));
+ g_free (utf8_filename);
g_free (filename);
return NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]