gresource: Complete the overlay support

Unlike the other g_resources_ functions, g_resources_get_info
was not respecting G_RESOURCE_OVERLAYS. Add this missing
support.

Closes: #1445
This commit is contained in:
Matthias Clasen 2018-11-27 00:13:22 -05:00
parent db0bce02cb
commit 68bcb8f048

View File

@ -285,6 +285,27 @@ enumerate_overlay_dir (const gchar *candidate,
return FALSE; return FALSE;
} }
typedef struct {
gsize size;
guint32 flags;
} InfoData;
static gboolean
get_overlay_info (const gchar *candidate,
gpointer user_data)
{
InfoData *info = user_data;
GStatBuf buf;
if (g_stat (candidate, &buf) < 0)
return FALSE;
info->size = buf.st_size;
info->flags = G_RESOURCE_FLAGS_NONE;
return TRUE;
}
static gboolean static gboolean
g_resource_find_overlay (const gchar *path, g_resource_find_overlay (const gchar *path,
CheckCandidate check, CheckCandidate check,
@ -1251,6 +1272,17 @@ g_resources_get_info (const gchar *path,
gboolean res = FALSE; gboolean res = FALSE;
GList *l; GList *l;
gboolean r_res; gboolean r_res;
InfoData info;
if (g_resource_find_overlay (path, get_overlay_info, &info))
{
if (size)
*size = info.size;
if (flags)
*flags = info.flags;
return TRUE;
}
register_lazy_static_resources (); register_lazy_static_resources ();