GResources: add support for resource overlays

Desktop / GNOME / GLib - Allison Ryan Lortie [desrt.ca] - 28 April 2016 07:36 UTC

When debugging a program or testing a change to an installed version, it is often useful to be able to replace resources in the program or a library, without recompiling.

To support this, for debugging and hacking purposes, it's now possible to define a G_RESOURCE_OVERLAYS environment variable as a colon-separated list of substitutions to perform when looking up GResources.

A substitution has the form

"/org/gtk/libgtk=/home/desrt/gtk-overlay"

The part before the '=' is the resource subpath for which the overlay applies. The part after is a filesystem path which contains files and subdirectories as you would like to be loaded as resources with the equivalent names.

In the example above, if an application tried to load a resource with the resource path '/org/gtk/libgtk/ui/gtkdialog.ui' then GResource would check the filesystem path '/home/desrt/gtk-overlay/ui/gtkdialog.ui'. If a file was found there, it would be used instead.

Substitutions must start with a slash, and must not have a trailing slash before the '='. It is possible to overlay the location of a single resource with an individual file.

https://bugzilla.gnome.org/show_bug.cgi?id=765668

55ab3af GResources: add support for resource overlays
gio/gresource.c | 310 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 310 insertions(+)

Upstream: git.gnome.org


  • Share