GCancellable *cancellable,
GError **error)
{
- gboolean result;
GFile *work_file = NULL;
GList *list = NULL, *l;
GError *my_error = NULL;
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
- result = g_file_make_directory (file, cancellable, &my_error);
- if (result || my_error->code != G_IO_ERROR_NOT_FOUND)
+ g_file_make_directory (file, cancellable, &my_error);
+ if (my_error == NULL || my_error->code != G_IO_ERROR_NOT_FOUND)
{
if (my_error)
g_propagate_error (error, my_error);
- return result;
+ return my_error == NULL;
}
work_file = g_object_ref (file);
- while (!result && my_error->code == G_IO_ERROR_NOT_FOUND)
+ while (my_error != NULL && my_error->code == G_IO_ERROR_NOT_FOUND)
{
GFile *parent_file;
break;
g_clear_error (&my_error);
-
- result = g_file_make_directory (parent_file, cancellable, &my_error);
+ g_file_make_directory (parent_file, cancellable, &my_error);
g_object_unref (work_file);
work_file = g_object_ref (parent_file);
- if (!result && my_error->code == G_IO_ERROR_NOT_FOUND)
+ if (my_error != NULL && my_error->code == G_IO_ERROR_NOT_FOUND)
list = g_list_prepend (list, parent_file); /* Transfer ownership of ref */
else
g_object_unref (parent_file);
}
- for (l = list; result && l; l = l->next)
+ for (l = list; my_error == NULL && l; l = l->next)
{
- result = g_file_make_directory ((GFile *) l->data, cancellable, &my_error);
+ g_file_make_directory ((GFile *) l->data, cancellable, &my_error);
}
if (work_file)
list = g_list_remove (list, list->data);
}
- if (!result)
+ if (my_error != NULL)
{
g_propagate_error (error, my_error);
- return result;
+ return FALSE;
}
return g_file_make_directory (file, cancellable, error);