Report errors when opening files

Signed-off-by: Nathan Samson <nathansamson@gmail.com>
This commit is contained in:
Nathan Samson 2011-09-05 22:14:53 +02:00
parent 65ef1bae20
commit 11becb8750
5 changed files with 100 additions and 25 deletions

View file

@ -1119,13 +1119,20 @@ static void reset_all(void)
uemis = 0;
}
void parse_xml_file(const char *filename)
void parse_xml_file(const char *filename, GError **error)
{
xmlDoc *doc;
doc = xmlReadFile(filename, NULL, 0);
if (!doc) {
fprintf(stderr, "Failed to parse '%s'.\n", filename);
if (error != NULL)
{
*error = g_error_new(g_quark_from_string("divelog"),
DIVE_ERROR_PARSE,
"Failed to parse '%s'",
filename);
}
return;
}