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.
This commit is contained in:
Matthias Clasen 2016-01-27 21:05:31 -05:00
parent d20e88fd11
commit 42699e37be

View File

@ -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,
utf8_filename = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errsv),
g_strerror (errsv));
"Error opening directory '%s': %s",
utf8_filename, g_strerror (errsv));
g_free (utf8_filename);
g_free (filename);
return NULL;
}