Now checking if text file loading was successful

This commit is contained in:
Gergely Polonkai 2013-01-02 02:18:47 +01:00
parent cca1c9df83
commit d87a26dbe1

View File

@ -49,7 +49,12 @@ wmud_texts_init(void)
g_debug("Loading text file %s from %s", text_files[i], text_file); g_debug("Loading text file %s from %s", text_files[i], text_file);
tf = g_file_new_for_path(text_file); tf = g_file_new_for_path(text_file);
tfi = g_file_query_info(tf, G_FILE_ATTRIBUTE_STANDARD_SIZE, G_FILE_QUERY_INFO_NONE, NULL, &err); tfi = g_file_query_info(tf, G_FILE_ATTRIBUTE_STANDARD_SIZE, G_FILE_QUERY_INFO_NONE, NULL, &err);
/* TODO: Error checking! */
if (err) {
g_warning("Error loading %s: %s", text_files[i], err->message);
continue;
}
tfs = g_file_info_get_attribute_uint64(tfi, G_FILE_ATTRIBUTE_STANDARD_SIZE); tfs = g_file_info_get_attribute_uint64(tfi, G_FILE_ATTRIBUTE_STANDARD_SIZE);
contents = g_malloc0(tfs + 1); contents = g_malloc0(tfs + 1);