mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
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:
parent
db0bce02cb
commit
68bcb8f048
@ -285,6 +285,27 @@ enumerate_overlay_dir (const gchar *candidate,
|
||||
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
|
||||
g_resource_find_overlay (const gchar *path,
|
||||
CheckCandidate check,
|
||||
@ -1251,6 +1272,17 @@ g_resources_get_info (const gchar *path,
|
||||
gboolean res = FALSE;
|
||||
GList *l;
|
||||
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 ();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user