rsvg_acquire_vfs_resource (const char *filename, const char *base_uri, GError ** error)
{
    GByteArray *array;

    GFile *file;
    char *data;
    gsize size;
    gboolean res = FALSE;

    rsvg_return_val_if_fail (filename != NULL, NULL, error);

    file = g_file_new_for_uri (filename);

    if (!(res = g_file_load_contents (file, NULL, &data, &size, NULL, error))) {
        if (base_uri != NULL) {
            GFile *base;

            g_clear_error (error);

            g_object_unref (file);

            base = g_file_new_for_uri (base_uri);
            file = g_file_resolve_relative_path (base, filename);
            g_object_unref (base);

            res = g_file_load_contents (file, NULL, &data, &size, NULL, error);
        }
    }

    g_object_unref (file);

    if (res) {
        array = g_byte_array_new ();

        g_byte_array_append (array, (guint8 *)data, size);
        g_free (data);
    } else {
        return NULL;
    }

    return array;
}
rsvg_acquire_vfs_resource (const char *filename, const char *base_uri, GError ** error)
{
    GByteArray *array;

    GFile *file;
    char *data;
    gsize size;
    gboolean res = FALSE;

    rsvg_return_val_if_fail (filename != NULL, NULL, error);

    file = g_file_new_for_uri (filename);

    if (!(res = g_file_load_contents (file, NULL, &data, &size, NULL, error))) {
        if (base_uri != NULL) {
            GFile *base;

            g_clear_error (error);

            g_object_unref (file);

            base = g_file_new_for_uri (base_uri);
            file = g_file_resolve_relative_path (base, filename);
            g_object_unref (base);

            res = g_file_load_contents (file, NULL, &data, &size, NULL, error);
        }
    }

    g_object_unref (file);

    if (res) {
        array = g_byte_array_new ();

        g_byte_array_append (array, (guint8 *)data, size);
        g_free (data);
    } else {
        return NULL;
    }

    return array;
}