diff options
author | Philip Withnall <withnall@endlessm.com> | 2017-01-11 14:01:25 +0000 |
---|---|---|
committer | Philip Withnall <withnall@endlessm.com> | 2017-02-05 15:03:57 +0100 |
commit | edc68f26599392013d6a4ac4cf20924d2f9b4d82 (patch) | |
tree | 8efc8e64607b3e0b0ae0cca4982f85176e79dd4a /glib/gkeyfile.c | |
parent | c131865f57c2786d1a498d58b9b4c1333397798c (diff) | |
download | glib-edc68f26599392013d6a4ac4cf20924d2f9b4d82.tar.gz |
gkeyfile: Be more specific about error codes in documentation
It’s hard to know whether trying to load a non-existent key file will
result in G_KEY_FILE_ERROR_NOT_FOUND or G_FILE_ERROR_NOENT; try to
improve the documentation to clarify that.
https://bugzilla.gnome.org/show_bug.cgi?id=777135
Diffstat (limited to 'glib/gkeyfile.c')
-rw-r--r-- | glib/gkeyfile.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c index abad20d39..b8a84db7b 100644 --- a/glib/gkeyfile.c +++ b/glib/gkeyfile.c @@ -828,8 +828,13 @@ g_key_file_load_from_fd (GKeyFile *key_file, * @error: return location for a #GError, or %NULL * * Loads a key file into an empty #GKeyFile structure. - * If the file could not be loaded then @error is set to - * either a #GFileError or #GKeyFileError. + * + * If the OS returns an error when opening or reading the file, a + * %G_FILE_ERROR is returned. If there is a problem parsing the file, a + * %G_KEY_FILE_ERROR is returned. + * + * This function will never return a %G_KEY_FILE_ERROR_NOT_FOUND error. If the + * @file is not found, %G_FILE_ERROR_NOENT is returned. * * Returns: %TRUE if a key file could be loaded, %FALSE otherwise * @@ -967,9 +972,13 @@ g_key_file_load_from_bytes (GKeyFile *key_file, * * This function looks for a key file named @file in the paths * specified in @search_dirs, loads the file into @key_file and - * returns the file's full path in @full_path. If the file could not - * be loaded then an %error is set to either a #GFileError or - * #GKeyFileError. + * returns the file's full path in @full_path. + * + * If the file could not be found in any of the @search_dirs, + * %G_KEY_FILE_ERROR_NOT_FOUND is returned. If + * the file is found but the OS returns an error when opening or reading the + * file, a %G_FILE_ERROR is returned. If there is a problem parsing the file, a + * %G_KEY_FILE_ERROR is returned. * * Returns: %TRUE if a key file could be loaded, %FALSE otherwise * |