diff --git a/moo/mooutils/mooutils-misc.c b/moo/mooutils/mooutils-misc.c index ab1dc281..22e6a372 100644 --- a/moo/mooutils/mooutils-misc.c +++ b/moo/mooutils/mooutils-misc.c @@ -1716,8 +1716,7 @@ moo_get_user_cache_file (const char *basename) static gboolean -save_config_file (const char *dir, - const char *filename, +save_config_file (const char *filename, const char *content, gssize len, GError **error) @@ -1725,7 +1724,6 @@ save_config_file (const char *dir, MooFileWriter *writer; gboolean retval; - g_return_val_if_fail (dir != NULL, FALSE); g_return_val_if_fail (filename != NULL, FALSE); g_return_val_if_fail (content != NULL, FALSE); @@ -1745,26 +1743,19 @@ save_user_data_file (const char *basename, gssize len, GError **error) { - char *dir, *file; + char *file; gboolean result; g_return_val_if_fail (basename != NULL, FALSE); g_return_val_if_fail (content != NULL, FALSE); if (cache) - { - dir = moo_get_user_cache_dir (); file = moo_get_user_cache_file (basename); - } else - { - dir = moo_get_user_data_dir (); file = moo_get_user_data_file (basename); - } - result = save_config_file (dir, file, content, len, error); + result = save_config_file (file, content, len, error); - g_free (dir); g_free (file); return result; } @@ -1793,17 +1784,13 @@ moo_save_config_file (const char *filename, gssize len, GError **error) { - char *dir; gboolean result; g_return_val_if_fail (filename != NULL, FALSE); g_return_val_if_fail (content != NULL, FALSE); - dir = g_path_get_dirname (filename); + result = save_config_file (filename, content, len, error); - result = save_config_file (dir, filename, content, len, error); - - g_free (dir); return result; } @@ -2489,6 +2476,14 @@ moo_atom_uri_list (void) } +const char * +moo_error_message (GError *error) +{ + moo_return_val_if_fail (error != NULL, "error"); + return error->message; +} + + static char *debug_domains; void _moo_set_debug (const char *domains); gboolean moo_debug_enabled (const char *domain, gboolean def_enabled); diff --git a/moo/mooutils/mooutils-misc.h b/moo/mooutils/mooutils-misc.h index 3532b330..eea9a837 100644 --- a/moo/mooutils/mooutils-misc.h +++ b/moo/mooutils/mooutils-misc.h @@ -232,6 +232,8 @@ gboolean _moo_regex_escape (const char *string, #define moo_obj_dup(type, p) ((type*) moo_dup_block (sizeof (type), p)) #endif +const char *moo_error_message (GError *error); + G_END_DECLS